This is for Gawk, which does not use malloc-gnu.
* lib/regex.c (_GL_USE_STDLIB_ALLOC) [!_LIBC]:
Define, since this module is now safe for AIX-like malloc.
* lib/regex_internal.h (re_malloc) [!_LIBC && !HAVE_MALLOC_0_NONNULL]:
Don’t pass 0 to malloc.
2026-04-27 Paul Eggert <eggert@cs.ucla.edu>
+ regex: port to non-GNU malloc
+ This is for Gawk, which does not use malloc-gnu.
+ * lib/regex.c (_GL_USE_STDLIB_ALLOC) [!_LIBC]:
+ Define, since this module is now safe for AIX-like malloc.
+ * lib/regex_internal.h (re_malloc) [!_LIBC && !HAVE_MALLOC_0_NONNULL]:
+ Don’t pass 0 to malloc.
+
regex: SSIZE_MAX porting
* lib/regex_internal.h (IDX_MAX) [_REGEX_LARGE_OFFSETS]:
Port to non-POSIX platforms where limits.h does not define SSIZE_MAX.
#define __STDC_WANT_IEC_60559_BFP_EXT__
#ifndef _LIBC
+# define _GL_USE_STDLIB_ALLOC 1
# include <libc-config.h>
# if __GNUC_PREREQ (4, 6)
# define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
-#define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
+#if defined _LIBC || HAVE_MALLOC_0_NONNULL
+# define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
+#else
+# define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t) + !(n)))
+#endif
#define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
#define re_free(p) free (p)