commit: 17ca9c594c3bb5a179d3f5e20c71acd742b4cac1
parent 9c24c9f53ec591ceec746ab315f05b912ff5bbfd
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 23 Apr 2024 19:38:41 +0200
configure: Add reallocarray test
Diffstat:
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
@@ -253,6 +253,11 @@ if check_conftest configure.d/splice.c; then
CFLAGS="${CFLAGS} -DHAS_SPLICE"
fi
+if ! check_conftest configure.d/reallocarray.c; then
+ echo 'Disabling cmd/tr'
+ echo 'cmd/tr' >> target_filter
+fi
+
echo
## Configuration write
diff --git a/configure.d/reallocarray.c b/configure.d/reallocarray.c
@@ -0,0 +1,16 @@
+// utils-std: Collection of commonly available Unix tools
+// SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
+// SPDX-License-Identifier: MPL-2.0
+
+// Because that's what our utilities will use :)
+#define _POSIX_C_SOURCE 200809L
+#define _BSD_SOURCE // for reallocarray
+
+#include <stdlib.h> // reallocarray
+
+void
+test()
+{
+ char *arr = NULL;
+ reallocarray(&arr, 69, sizeof(*arr));
+}