if [ "$REALLOCARRAY" = no ]; then
echo "COMPAT_SRCS+= compat/reallocarray.c" >>$CONFIG_MK
echo "#include \"compat/reallocarray.h\"">>$CONFIG_H
+else
+ echo "#define HAVE_REALLOCARRAY" >>$CONFIG_H
fi
if [ -z "$POLL" ]; then
int exitcode;
};
+#ifdef HAVE_REALLOCARRAY
+#define eloop_realloca reallocarray
+#else
/* Handy routing to check for potential overflow.
- * reallocarray(3) and reallocarr(3) are not portable and this
- * implementation is smaller than using either in libc in
- * the final binary size. */
+ * reallocarray(3) and reallocarr(3) are not portable. */
#define SQRT_SIZE_MAX (((size_t)1) << (sizeof(size_t) * CHAR_BIT / 2))
static void *
eloop_realloca(void *ptr, size_t n, size_t size)
}
return realloc(ptr, n * size);
}
+#endif
#ifdef HAVE_POLL
static void