1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-04-28 06:33:36 +00:00

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.
This commit is contained in:
Paul Eggert
2026-04-27 14:15:40 -07:00
parent 41aa686604
commit f2bbb4391e
2 changed files with 10 additions and 1 deletions

View File

@@ -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__,

View File

@@ -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