]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
regex: SSIZE_MAX porting
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 27 Apr 2026 21:15:40 +0000 (14:15 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 27 Apr 2026 22:01:18 +0000 (15:01 -0700)
* lib/regex_internal.h (IDX_MAX) [_REGEX_LARGE_OFFSETS]:
Port to non-POSIX platforms where limits.h does not define SSIZE_MAX.
This is for Gawk, which does not use Gnulib limits.h.

ChangeLog
lib/regex_internal.h

index a3a87e555e6816aedbba975731e1548449b175f2..95d69e6611ba2033579d98fe0a52a9af5ccf05df 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2026-04-27  Paul Eggert  <eggert@cs.ucla.edu>
 
+       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.
+       This is for Gawk, which does not use Gnulib limits.h.
+
        idx: cleaner namespace on GNU
        * lib/idx.h: Include <stddef.h>, <stdint.h> only if needed.
        (idx_t, IDX_MAX): Rely on builtin macros __PTRDIFF_TYPE__,
index 87ed00b87a2daa1b922e776b0d4608997789e8b7..6e526a6f3886d7c22d4edb249880f48a193f92fe 100644 (file)
    reindenting a lot of regex code that formerly used 'int'.  */
 typedef regoff_t Idx;
 #ifdef _REGEX_LARGE_OFFSETS
-# define IDX_MAX SSIZE_MAX
+# ifdef SSIZE_MAX
+#  define IDX_MAX SSIZE_MAX
+# else
+#  define IDX_MAX ((Idx) ((size_t) -1 / 2))
+# endif
 #else
 # define IDX_MAX INT_MAX
 #endif