]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
Rose: make HWLM callbacks take scratch as ctx
authorJustin Viiret <justin.viiret@intel.com>
Thu, 3 Mar 2016 03:14:30 +0000 (14:14 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 20 Apr 2016 03:34:54 +0000 (13:34 +1000)
src/rose/block.c
src/rose/eod.c
src/rose/match.c
src/rose/stream.c

index 853f1ead55beb2941eb1ad1eda28a508afb3dbcd..749bf4e2f36c3d56b3ef2df4be52d83dab8a86b6 100644 (file)
@@ -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:;
index 24e9113d7342c91da5b785b2632d129fafdb0a89..449f26f49cf8c8e6446e59f124315cb8f054135c 100644 (file)
@@ -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);
index 57a1688c807dd8df8022cbeb52defe4be0c6cc00..b2b0238de2b463c46118cbd63a707f54dd102dcc 100644 (file)
@@ -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;
index 759f7553252b0e57d789853920b927ab65190430..31a0227f584db96f51c4992878c92193b2cd68ed 100644 (file)
@@ -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);
     }