From: Paul Eggert <eggert@cs.ucla.edu>
To: bug-gnulib@gnu.org, emacs-devel@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH 2/4] dfa: omit unnecessary ptrdiff_t check
Date: Tue, 10 Jan 2017 02:13:30 -0800 [thread overview]
Message-ID: <20170110101332.15354-2-eggert@cs.ucla.edu> (raw)
In-Reply-To: <20170110101332.15354-1-eggert@cs.ucla.edu>
* 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 <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.
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
next prev parent reply other threads:[~2017-01-10 10:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-10 10:13 [PATCH 1/4] dfa: omit unnecessary allocation Paul Eggert
2017-01-10 10:13 ` Paul Eggert [this message]
2017-01-10 10:13 ` [PATCH 3/4] dfa: shrink constraints from 4 bits to 3 Paul Eggert
2017-01-10 10:13 ` [PATCH 4/4] dfa: minor simplification with emptyset Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170110101332.15354-2-eggert@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=bug-gnulib@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).