mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
limex: fold TESTEOD_REV_FN use into TESTEOD_FN
This commit is contained in:
parent
9c99a923a1
commit
3dcfea19e0
@ -39,7 +39,6 @@
|
||||
#define IMPL_NFA_T JOIN(struct LimExNFA, SIZE)
|
||||
|
||||
#define TESTEOD_FN JOIN(moNfaTestEod, SIZE)
|
||||
#define TESTEOD_REV_FN JOIN(moNfaRevTestEod, SIZE)
|
||||
#define LIMEX_INACCEPT_FN JOIN(limexInAccept, SIZE)
|
||||
#define LIMEX_INANYACCEPT_FN JOIN(limexInAnyAccept, SIZE)
|
||||
#define EXPIRE_ESTATE_FN JOIN(limexExpireExtendedState, SIZE)
|
||||
@ -158,7 +157,8 @@ char PROCESS_ACCEPTS_NOSQUASH_FN(const STATE_T *s,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Run EOD accepts.
|
||||
// Run EOD accepts. Note that repeat_ctrl and repeat_state may be NULL if this
|
||||
// LimEx contains no repeat structures.
|
||||
static really_inline
|
||||
char TESTEOD_FN(const IMPL_NFA_T *limex, const STATE_T *s,
|
||||
const union RepeatControl *repeat_ctrl,
|
||||
@ -189,33 +189,6 @@ char TESTEOD_FN(const IMPL_NFA_T *limex, const STATE_T *s,
|
||||
return MO_CONTINUE_MATCHING;
|
||||
}
|
||||
|
||||
static really_inline
|
||||
char TESTEOD_REV_FN(const IMPL_NFA_T *limex, const STATE_T *s, u64a offset,
|
||||
NfaCallback callback, void *context) {
|
||||
assert(limex && s);
|
||||
|
||||
// There may not be any EOD accepts in this NFA.
|
||||
if (!limex->acceptEodCount) {
|
||||
return MO_CONTINUE_MATCHING;
|
||||
}
|
||||
|
||||
STATE_T acceptEodMask = LOAD_FROM_ENG(&limex->acceptAtEOD);
|
||||
STATE_T foundAccepts = AND_STATE(*s, acceptEodMask);
|
||||
|
||||
assert(!limex->repeatCount);
|
||||
|
||||
if (unlikely(ISNONZERO_STATE(foundAccepts))) {
|
||||
const struct NFAAccept *acceptEodTable = getAcceptEodTable(limex);
|
||||
if (PROCESS_ACCEPTS_NOSQUASH_FN(&foundAccepts, acceptEodTable,
|
||||
limex->acceptEodCount, offset, callback,
|
||||
context)) {
|
||||
return MO_HALT_MATCHING;
|
||||
}
|
||||
}
|
||||
|
||||
return MO_CONTINUE_MATCHING;
|
||||
}
|
||||
|
||||
// Run accepts corresponding to current state.
|
||||
static really_inline
|
||||
char REPORTCURRENT_FN(const IMPL_NFA_T *limex, const struct mq *q) {
|
||||
@ -391,7 +364,6 @@ char LIMEX_INANYACCEPT_FN(const IMPL_NFA_T *limex, STATE_T state,
|
||||
}
|
||||
|
||||
#undef TESTEOD_FN
|
||||
#undef TESTEOD_REV_FN
|
||||
#undef REPORTCURRENT_FN
|
||||
#undef EXPIRE_ESTATE_FN
|
||||
#undef LIMEX_INACCEPT_FN
|
||||
|
@ -46,7 +46,6 @@
|
||||
#define IMPL_NFA_T JOIN(struct LimExNFA, SIZE)
|
||||
|
||||
#define TESTEOD_FN JOIN(moNfaTestEod, SIZE)
|
||||
#define TESTEOD_REV_FN JOIN(moNfaRevTestEod, SIZE)
|
||||
#define INITIAL_FN JOIN(moNfaInitial, SIZE)
|
||||
#define TOP_FN JOIN(moNfaTop, SIZE)
|
||||
#define TOPN_FN JOIN(moNfaTopN, SIZE)
|
||||
@ -927,8 +926,11 @@ char JOIN(LIMEX_API_ROOT, _B_Reverse)(const struct NFA *n, u64a offset,
|
||||
REV_STREAM_FN(limex, hbuf, hlen, &ctx, offset);
|
||||
}
|
||||
|
||||
if (offset == 0 && ISNONZERO_STATE(ctx.s)) {
|
||||
TESTEOD_REV_FN(limex, &ctx.s, offset, cb, context);
|
||||
if (offset == 0 && limex->acceptEodCount && ISNONZERO_STATE(ctx.s)) {
|
||||
const union RepeatControl *repeat_ctrl = NULL;
|
||||
const char *repeat_state = NULL;
|
||||
TESTEOD_FN(limex, &ctx.s, repeat_ctrl, repeat_state, offset, cb,
|
||||
context);
|
||||
}
|
||||
|
||||
// NOTE: return value is unused.
|
||||
@ -991,7 +993,6 @@ enum nfa_zombie_status JOIN(LIMEX_API_ROOT, _zombie_status)(
|
||||
}
|
||||
|
||||
#undef TESTEOD_FN
|
||||
#undef TESTEOD_REV_FN
|
||||
#undef INITIAL_FN
|
||||
#undef TOP_FN
|
||||
#undef TOPN_FN
|
||||
|
Loading…
x
Reference in New Issue
Block a user