]> Savannah Git Hosting - gnulib.git/commitdiff
dfa: omit unnecessary ptrdiff_t check
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 10 Jan 2017 04:28:11 +0000 (20:28 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 10 Jan 2017 10:13:13 +0000 (02:13 -0800)
* lib/dfa.c (alloc_position_set): Do not worry about ptrdiff_t
overflow, since xnmalloc does that now.

ChangeLog
lib/dfa.c

index beeefb7f3d2cfb76a27c0ab4e612c5cb3209ae68..91cdc6d31e6cc98799039dd12cca4f3fb473693e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-01-09  Paul Eggert  <eggert@cs.ucla.edu>
 
+       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.
index b27bef484c92c372eff072192e7946e70134c419..509d6d1cbd23de9e6969a54e27b4c8a35ba6dd80 100644 (file)
--- 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;
 }