[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/4] dfa: omit unnecessary ptrdiff_t check
From: |
Paul Eggert |
Subject: |
[PATCH 2/4] dfa: omit unnecessary ptrdiff_t check |
Date: |
Tue, 10 Jan 2017 02:13:30 -0800 |
* lib/dfa.c (alloc_position_set): Do not worry about ptrdiff_t
overflow, since xnmalloc does that now.
---
ChangeLog | 4 ++++
lib/dfa.c | 2 --
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index beeefb7..91cdc6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2017-01-09 Paul Eggert <address@hidden>
+ 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 b27bef4..509d6d1 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;
}
--
2.9.3