nfa: unify NfaCallback and SomNfaCallback

Use just one callback type, with both start and end offsets.
This commit is contained in:
Justin Viiret
2016-06-24 16:22:43 +10:00
committed by Matthew Barr
parent 9087d59be5
commit cf9e40ae1c
29 changed files with 103 additions and 234 deletions

View File

@@ -722,13 +722,13 @@ u64a roseGetHaigSom(const struct RoseEngine *t, struct hs_scratch *scratch,
u64a start = ~0ULL;
/* switch the callback + context for a fun one */
q->som_cb = roseNfaEarliestSom;
q->cb = roseNfaEarliestSom;
q->context = &start;
nfaReportCurrentMatches(q->nfa, q);
/* restore the old callback + context */
q->som_cb = roseNfaSomAdaptor;
q->cb = roseNfaAdaptor;
q->context = NULL;
DEBUG_PRINTF("earliest som is %llu\n", start);
return start;
@@ -779,7 +779,7 @@ hwlmcb_rv_t roseEnginesEod(const struct RoseEngine *rose,
}
if (nfaCheckFinalState(q->nfa, q->state, q->streamState, offset,
roseReportAdaptor, roseReportSomAdaptor,
roseReportAdaptor,
scratch) == MO_HALT_MATCHING) {
DEBUG_PRINTF("user instructed us to stop\n");
return HWLM_TERMINATE_MATCHING;
@@ -815,7 +815,7 @@ hwlmcb_rv_t roseSuffixesEod(const struct RoseEngine *rose,
continue;
}
if (nfaCheckFinalState(q->nfa, q->state, q->streamState, offset,
roseReportAdaptor, roseReportSomAdaptor,
roseReportAdaptor,
scratch) == MO_HALT_MATCHING) {
DEBUG_PRINTF("user instructed us to stop\n");
return HWLM_TERMINATE_MATCHING;