mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 11:16:29 +03:00
nfaCheckFinalState: define return value
Make nfaCheckFinalState return MO_HALT_MATCHING when the user instructs us (via the callback return value) to halt matching. In the caller, check this value and stop matching if told.
This commit is contained in:
committed by
Matthew Barr
parent
843ca0e7cc
commit
621dfbebb7
@@ -168,8 +168,12 @@ void roseCheckNfaEod(const struct RoseEngine *t, char *state,
|
||||
nfaExpandState(nfa, fstate, sstate, offset, key);
|
||||
}
|
||||
|
||||
nfaCheckFinalState(nfa, fstate, sstate, offset, scratch->tctxt.cb,
|
||||
scratch->tctxt.cb_som, scratch->tctxt.userCtx);
|
||||
if (nfaCheckFinalState(nfa, fstate, sstate, offset, scratch->tctxt.cb,
|
||||
scratch->tctxt.cb_som,
|
||||
scratch->tctxt.userCtx) == MO_HALT_MATCHING) {
|
||||
DEBUG_PRINTF("user instructed us to stop\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,8 +217,13 @@ void roseCheckEodSuffixes(const struct RoseEngine *t, char *state, u64a offset,
|
||||
* history buffer. */
|
||||
char rv = nfaQueueExecRose(q->nfa, q, MO_INVALID_IDX);
|
||||
if (rv) { /* nfa is still alive */
|
||||
nfaCheckFinalState(nfa, fstate, sstate, offset, scratch->tctxt.cb,
|
||||
scratch->tctxt.cb_som, scratch->tctxt.userCtx);
|
||||
if (nfaCheckFinalState(nfa, fstate, sstate, offset,
|
||||
scratch->tctxt.cb, scratch->tctxt.cb_som,
|
||||
scratch->tctxt.userCtx) ==
|
||||
MO_HALT_MATCHING) {
|
||||
DEBUG_PRINTF("user instructed us to stop\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user