changeset 18666:96998d4c366e

dfa: omit unnecessary ptrdiff_t check * lib/dfa.c (alloc_position_set): Do not worry about ptrdiff_t overflow, since xnmalloc does that now.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 09 Jan 2017 20:28:11 -0800
parents afc065cdceb9
children c83459d710c4
files ChangeLog lib/dfa.c
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jan 09 20:26:02 2017 -0800
+++ b/ChangeLog	Mon Jan 09 20:28:11 2017 -0800
@@ -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.
--- a/lib/dfa.c	Mon Jan 09 20:26:02 2017 -0800
+++ b/lib/dfa.c	Mon Jan 09 20:28:11 2017 -0800
@@ -2007,8 +2007,6 @@
 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;
 }