mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Rose: make HWLM callbacks take scratch as ctx
This commit is contained in:
parent
f7a40b200d
commit
6af1ead0aa
@ -61,11 +61,11 @@ void runAnchoredTableBlock(const struct RoseEngine *t, const void *atable,
|
||||
if (nfa->type == MCCLELLAN_NFA_8) {
|
||||
nfaExecMcClellan8_B(nfa, curr->anchoredMinDistance,
|
||||
local_buffer, local_alen,
|
||||
roseAnchoredCallback, &scratch->tctxt);
|
||||
roseAnchoredCallback, scratch);
|
||||
} else {
|
||||
nfaExecMcClellan16_B(nfa, curr->anchoredMinDistance,
|
||||
local_buffer, local_alen,
|
||||
roseAnchoredCallback, &scratch->tctxt);
|
||||
roseAnchoredCallback, scratch);
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ void roseBlockExec_i(const struct RoseEngine *t, struct hs_scratch *scratch,
|
||||
DEBUG_PRINTF("BEGIN SMALL BLOCK (over %zu/%zu)\n", sblen, length);
|
||||
DEBUG_PRINTF("-- %016llx\n", tctxt->groups);
|
||||
hwlmExec(sbtable, scratch->core_info.buf, sblen, 0, roseCallback,
|
||||
tctxt, tctxt->groups);
|
||||
scratch, tctxt->groups);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ void roseBlockExec_i(const struct RoseEngine *t, struct hs_scratch *scratch,
|
||||
DEBUG_PRINTF("BEGIN FLOATING (over %zu/%zu)\n", flen, length);
|
||||
DEBUG_PRINTF("-- %016llx\n", tctxt->groups);
|
||||
hwlmExec(ftable, buffer, flen, t->floatingMinDistance,
|
||||
roseCallback, tctxt, tctxt->groups);
|
||||
roseCallback, scratch, tctxt->groups);
|
||||
}
|
||||
|
||||
exit:;
|
||||
|
@ -93,7 +93,8 @@ hwlmcb_rv_t roseEodRunMatcher(const struct RoseEngine *t, u64a offset,
|
||||
struct RoseContext *tctxt = &scratch->tctxt;
|
||||
const struct HWLM *etable = getELiteralMatcher(t);
|
||||
|
||||
hwlmExec(etable, eod_data, eod_len, adj, roseCallback, tctxt, tctxt->groups);
|
||||
hwlmExec(etable, eod_data, eod_len, adj, roseCallback, scratch,
|
||||
tctxt->groups);
|
||||
|
||||
// We may need to fire delayed matches
|
||||
return cleanUpDelayed(t, scratch, 0, offset);
|
||||
|
@ -223,8 +223,8 @@ event_enqueued:
|
||||
}
|
||||
|
||||
int roseAnchoredCallback(u64a end, u32 id, void *ctx) {
|
||||
struct RoseContext *tctxt = ctx;
|
||||
struct hs_scratch *scratch = tctxtToScratch(tctxt);
|
||||
struct hs_scratch *scratch = ctx;
|
||||
struct RoseContext *tctxt = &scratch->tctxt;
|
||||
struct core_info *ci = &scratch->core_info;
|
||||
const struct RoseEngine *t = ci->rose;
|
||||
|
||||
@ -507,8 +507,8 @@ anchored_leftovers:;
|
||||
}
|
||||
|
||||
hwlmcb_rv_t roseCallback(size_t start, size_t end, u32 id, void *ctxt) {
|
||||
struct RoseContext *tctx = ctxt;
|
||||
struct hs_scratch *scratch = tctxtToScratch(tctx);
|
||||
struct hs_scratch *scratch = ctxt;
|
||||
struct RoseContext *tctx = &scratch->tctxt;
|
||||
const struct RoseEngine *t = scratch->core_info.rose;
|
||||
|
||||
u64a real_end = end + tctx->lit_offset_adjust;
|
||||
|
@ -83,11 +83,11 @@ void runAnchoredTableStream(const struct RoseEngine *t, const void *atable,
|
||||
if (nfa->type == MCCLELLAN_NFA_8) {
|
||||
nfaExecMcClellan8_SimpStream(nfa, state, scratch->core_info.buf,
|
||||
start, adj, alen, roseAnchoredCallback,
|
||||
&scratch->tctxt);
|
||||
scratch);
|
||||
} else {
|
||||
nfaExecMcClellan16_SimpStream(nfa, state, scratch->core_info.buf,
|
||||
start, adj, alen, roseAnchoredCallback,
|
||||
&scratch->tctxt);
|
||||
start, adj, alen,
|
||||
roseAnchoredCallback, scratch);
|
||||
}
|
||||
|
||||
next_nfa:
|
||||
@ -542,7 +542,7 @@ void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch,
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("BEGIN FLOATING (over %zu/%zu)\n", flen, length);
|
||||
hwlmExecStreaming(ftable, scratch, flen, start, roseCallback, tctxt,
|
||||
hwlmExecStreaming(ftable, scratch, flen, start, roseCallback, scratch,
|
||||
tctxt->groups, stream_state);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user