From eb73ecacc856e155576d396c20c74159a70f4ada Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 14 Dec 2016 15:11:28 -0800 Subject: [PATCH] dfa: fix glitches in previous commit Sorry, I don't know how I managed to commit the wrong version. * lib/dfa.c (MIN): Move up. (xpalloc): Now static. --- ChangeLog | 6 ++++++ lib/dfa.c | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e578cc6809..b7091c116d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2016-12-14 Paul Eggert + dfa: fix glitches in previous commit + Sorry, I don't know how I managed to commit the wrong version. + * lib/dfa.c (MIN): Move up. + (xpalloc): Now static. + dfa: fix some unlikely integer overflows I found these while reviewing the recent Coverity-related fix. This patch changes part of dfa.c to prefer ptrdiff_t instead of @@ -30,6 +35,7 @@ expression is false. (realloc_trans_if_necessary): Remove assertion, which I hope Coverity no longer needs. + * modules/dfa (Depends-on): Add intprops, stdint. 2016-12-12 Jim Meyering diff --git a/lib/dfa.c b/lib/dfa.c index d0cb35b40f..8221086a66 100644 --- a/lib/dfa.c +++ b/lib/dfa.c @@ -54,6 +54,10 @@ #include "xalloc.h" #include "localeinfo.h" +#ifndef MIN +# define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + /* HPUX defines these as macros in sys/param.h. */ #ifdef setbit # undef setbit @@ -749,7 +753,7 @@ emptyset (charclass const s) Thus, to grow an array A without saving its old contents, do { free (A); A = xpalloc (NULL, &AITEMS, ...); }. */ -void * +static void * xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min, ptrdiff_t nitems_max, ptrdiff_t item_size) { @@ -932,10 +936,6 @@ using_simple_locale (bool multibyte) } \ } while (false) -#ifndef MIN -# define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif - typedef int predicate (int); /* The following list maps the names of the Posix named character classes -- 2.39.5