summaryrefslogtreecommitdiff
path: root/def.h
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-06 17:42:04 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-01-01 14:34:57 -0800
commit40bcc8c3303a858c786f1d6d04ae5bbdec6b04ff (patch)
tree1d6ad569496120004426e60a8c6d40b7584700d6 /def.h
parent47f2e64d865568d4f00cb97e42ad5cfc47e9c161 (diff)
Use reallocarray() on systems that provide it
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'def.h')
-rw-r--r--def.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/def.h b/def.h
index 676b395..34bc767 100644
--- a/def.h
+++ b/def.h
@@ -38,6 +38,11 @@ in this Software without prior written authorization from The Open Group.
#include <fcntl.h>
#include <sys/stat.h>
+#ifndef HAVE_REALLOCARRAY
+#define reallocarray(ptr, num, size) realloc(ptr, (num) * (size))
+#endif
+#define mallocarray(num, size) reallocarray(NULL, num, size)
+
#define MAXDEFINES 512
#define MAXFILES 2048
#define MAXINCFILES 128 /* "-include" files */