From 429b3497d18814557195b83008700d0893a3b342 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 11 Oct 2022 09:03:59 -0700 Subject: maint: prefer stdckdint.h to intprops.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/grep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/grep.c') diff --git a/src/grep.c b/src/grep.c index 9b9407d6..40ddfea0 100644 --- a/src/grep.c +++ b/src/grep.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #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); } -- cgit v1.2.1