From: Jim Meyering Date: Sat, 20 May 2017 00:02:56 +0000 (-0700) Subject: dfa: two small simplifications X-Git-Tag: v1.0~6128 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=809f19dba7cf85e4ea16246786cf19269590abf8;p=gnulib.git dfa: two small simplifications * lib/dfa.c (build_state): Avoid repeating longer expressions. --- diff --git a/ChangeLog b/ChangeLog index 807c8ed854..2ab6170b85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-05-19 Jim Meyering + + dfa: two small simplifications + * lib/dfa.c (build_state): Avoid repeating longer expressions. + 2017-05-18 Jim Meyering fallthrough: update for GCC 7/8 diff --git a/lib/dfa.c b/lib/dfa.c index e08e63a56e..2b9c80e705 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