From 8d85bd1e2f9473958b235caf7af9913b518f73dd Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 10 Dec 2022 14:07:18 -0800 Subject: Replace uTypedRecalloc() with direct recallocarray() calls Retains uRecalloc() as a fallback for platforms without recallocarray() Signed-off-by: Alan Coopersmith --- utils.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'utils.h') diff --git a/utils.h b/utils.h index 36f9e2a..1d33396 100644 --- a/utils.h +++ b/utils.h @@ -80,16 +80,19 @@ typedef int Comparison; #define reallocarray(p, n, s) realloc(p, (n) * (s)) #endif -extern Opaque uRecalloc(Opaque /* old */ , - unsigned /* nOld */ , - unsigned /* nNew */ , - unsigned /* newSize */ +#ifndef HAVE_RECALLOCARRAY +#define recallocarray uRecalloc + +extern void *uRecalloc(void * /* old */ , + size_t /* nOld */ , + size_t /* nNew */ , + size_t /* newSize */ ); +#endif + extern void uFree(Opaque /* ptr */ ); -#define uTypedRecalloc(pO,o,n,t) ((t *)uRecalloc((Opaque)pO,((unsigned)o),((unsigned)n),sizeof(t))) - /***====================================================================***/ extern Boolean uSetErrorFile(char * /* name */ -- cgit v1.2.3