From: Paul Eggert Date: Mon, 27 Apr 2026 21:15:40 +0000 (-0700) Subject: regex: SSIZE_MAX porting X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2bbb4391ee2ee20c5a9b9104afaf747df653d37;p=thirdparty%2Fgnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index a3a87e555e..95d69e6611 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2026-04-27 Paul Eggert + 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 , 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