Discussion:
[PATCH] dfa: two small simplifications
Jim Meyering
2017-05-20 00:12:58 UTC
Permalink
FYI, I've just pushed the following:

Subject: [PATCH] dfa: two small simplifications

* lib/dfa.c (build_state): Avoid repeating longer expressions.
---
ChangeLog | 5 +++++
lib/dfa.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 807c8ed..2ab6170 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-19 Jim Meyering <***@fb.com>
+
+ dfa: two small simplifications
+ * lib/dfa.c (build_state): Avoid repeating longer expressions.
+
2017-05-18 Jim Meyering <***@fb.com>

fallthrough: update for GCC 7/8
diff --git a/lib/dfa.c b/lib/dfa.c
index e08e63a..2b9c80e 100644
--- a/lib/dfa.c
+++ b/lib/dfa.c
@@ -2712,13 +2712,13 @@ build_state (state_num s, struct dfa *d, unsigned char uc)
else if (d->tokens[pos.index] >= CSET)
{
matches = d->charclasses[d->tokens[pos.index] - CSET];
- if (tstbit (uc, &d->charclasses[d->tokens[pos.index] - CSET]))
+ if (tstbit (uc, &matches))
matched = true;
}
else if (d->tokens[pos.index] == ANYCHAR)
{
matches = d->charclasses[d->canychar];
- if (tstbit (uc, &d->charclasses[d->canychar]))
+ if (tstbit (uc, &matches))
matched = true;

/* ANYCHAR must match with a single character, so we must put
--
2.9.4
Loading...