diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2012-02-05 18:00:44 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-02-26 11:01:14 +0100 |
commit | d7acc337e47563b8334b56c5d479c81a4a060c8f (patch) | |
tree | d5595b6cbb28aee1cb397163b72888709c7d2107 /src | |
parent | d8951d3f4e1bbd564809aa8e713d8333bda2f802 (diff) | |
download | grep-d7acc337e47563b8334b56c5d479c81a4a060c8f.tar.gz |
dfa: do not use MATCHES_*_CONTEXT directly
* src/dfa.c (dfastate): Use SUCCEEDS_IN_CONTEXT.
Diffstat (limited to 'src')
-rw-r--r-- | src/dfa.c | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -2503,23 +2503,20 @@ dfastate (int s, struct dfa *d, int trans[]) /* Some characters may need to be eliminated from matches because they fail in the current context. */ - if (pos.constraint != 0xFF) + if (pos.constraint != NO_CONSTRAINT) { - if (! MATCHES_NEWLINE_CONTEXT(pos.constraint, - d->states[s].context, CTX_NEWLINE)) - clrbit(eolbyte, matches); - if (! MATCHES_NEWLINE_CONTEXT(pos.constraint, - d->states[s].context, ~CTX_NEWLINE)) + if (! SUCCEEDS_IN_CONTEXT(pos.constraint, + d->states[s].context, CTX_NEWLINE)) for (j = 0; j < CHARCLASS_INTS; ++j) - matches[j] &= newline[j]; - if (! MATCHES_LETTER_CONTEXT(pos.constraint, - d->states[s].context, CTX_LETTER)) + matches[j] &= ~newline[j]; + if (! SUCCEEDS_IN_CONTEXT(pos.constraint, + d->states[s].context, CTX_LETTER)) for (j = 0; j < CHARCLASS_INTS; ++j) matches[j] &= ~letters[j]; - if (! MATCHES_LETTER_CONTEXT(pos.constraint, - d->states[s].context, ~CTX_LETTER)) + if (! SUCCEEDS_IN_CONTEXT(pos.constraint, + d->states[s].context, CTX_NONE)) for (j = 0; j < CHARCLASS_INTS; ++j) - matches[j] &= letters[j]; + matches[j] &= letters[j] | newline[j]; /* If there are no characters left, there's no point in going on. */ for (j = 0; j < CHARCLASS_INTS && !matches[j]; ++j) |