From 9bcc0e94b891221b9537a8e9faac080ca6b78e95 Mon Sep 17 00:00:00 2001 From: Mansour Moufid
Date: Thu, 22 Sep 2011 12:05:42 -0400 Subject: [PATCH] Add a new `xsumn' function to `lib/xsize.h'. This implements a variadic sum function with overflow checking, similar to xsum{2,3,4} but for an arbitrary n number of arguments. For example: size_t size = xsumn (4, 9, 10, 11, 12); /* size == 42 */ void *p = (size_in_bounds_p (size) ? malloc (size) : NULL); --- lib/xsize.h | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/lib/xsize.h b/lib/xsize.h index f75655a..af2fd2d 100644 --- a/lib/xsize.h +++ b/lib/xsize.h @@ -28,6 +28,8 @@ # include