bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] dfa: two small simplifications


From: Jim Meyering
Subject: [PATCH] dfa: two small simplifications
Date: Fri, 19 May 2017 17:12:58 -0700

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  <address@hidden>
+
+       dfa: two small simplifications
+       * lib/dfa.c (build_state): Avoid repeating longer expressions.
+
 2017-05-18  Jim Meyering  <address@hidden>

        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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]