diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2022-10-11 09:03:59 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2022-10-11 09:05:15 -0700 |
commit | 429b3497d18814557195b83008700d0893a3b342 (patch) | |
tree | 4820e2b668f5edceb000c64833b49c4516b2b894 /src/grep.c | |
parent | 1dd9bbe724624220a6ea136a1199d5172e5c1312 (diff) | |
download | grep-429b3497d18814557195b83008700d0893a3b342.tar.gz |
maint: prefer stdckdint.h to intprops.h
Prefer the standard C23 ckd_* macros to Gnulib’s *_WRAPV macros.
* bootstrap.conf (gnulib_modules): Add stdckdint.
* src/grep.c, src/kwset.c, src/pcresearch.c:
Include stdckdint.h, and prefer ckd_* to *_WRAPV.
Include intprops.h only if needed.
Diffstat (limited to 'src/grep.c')
-rw-r--r-- | src/grep.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -24,6 +24,7 @@ #include <wchar.h> #include <inttypes.h> #include <stdarg.h> +#include <stdckdint.h> #include <stdint.h> #include <stdio.h> #include "system.h" @@ -898,7 +899,7 @@ static intmax_t add_count (intmax_t a, idx_t b) { intmax_t sum; - if (!INT_ADD_OK (a, b, &sum)) + if (ckd_add (&sum, a, b)) die (EXIT_TROUBLE, 0, _("input is too large to count")); return sum; } @@ -982,7 +983,7 @@ fillbuf (idx_t save, struct stat const *st) off_t to_be_read = st->st_size - bufoffset; ptrdiff_t a; if (0 <= to_be_read - && INT_ADD_OK (to_be_read, save + min_after_buflim, &a)) + && !ckd_add (&a, to_be_read, save + min_after_buflim)) alloc_max = MAX (a, bufalloc + incr_min); } |