* 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 | 5 +++++ lib/regex_internal.h | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog index a3a87e555e..95d69e6611 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2026-04-27 Paul Eggert <[email protected]> + 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__, diff --git a/lib/regex_internal.h b/lib/regex_internal.h index 87ed00b87a..6e526a6f38 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -180,7 +180,11 @@ 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 -- 2.53.0
