From: Paul Eggert Date: Tue, 10 Jan 2017 04:28:11 +0000 (-0800) Subject: dfa: omit unnecessary ptrdiff_t check X-Git-Tag: v1.0~6393 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=9d561f0d2e8be501d0725bd566520f6b44c6bc22;p=gnulib.git dfa: omit unnecessary ptrdiff_t check * lib/dfa.c (alloc_position_set): Do not worry about ptrdiff_t overflow, since xnmalloc does that now. --- diff --git a/ChangeLog b/ChangeLog index beeefb7f3d..91cdc6d31e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2017-01-09 Paul Eggert + dfa: omit unnecessary ptrdiff_t check + * lib/dfa.c (alloc_position_set): Do not worry about ptrdiff_t + overflow, since xnmalloc does that now. + dfa: omit unnecessary allocation * lib/dfa.c (dfaanalyze): Do not allocate follow set, since an all-zero follow set works just fine. diff --git a/lib/dfa.c b/lib/dfa.c index b27bef484c..509d6d1cbd 100644 --- a/lib/dfa.c +++ b/lib/dfa.c @@ -2007,8 +2007,6 @@ static void alloc_position_set (position_set *s, size_t size) { s->elems = xnmalloc (size, sizeof *s->elems); - if (PTRDIFF_MAX < SIZE_MAX / sizeof *s->elems && PTRDIFF_MAX < size) - xalloc_die (); s->alloc = size; s->nelem = 0; }