]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
stream: simplify do_rebuild call site
authorJustin Viiret <justin.viiret@intel.com>
Mon, 30 Jan 2017 22:53:16 +0000 (09:53 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 26 Apr 2017 04:46:49 +0000 (14:46 +1000)
src/rose/stream.c

index 31224276eee1bd7f12fd3bd646a1794d9344ce97..c68cd8ab99f2eeb3919c5f418e38bb6bee962a6c 100644 (file)
@@ -413,13 +413,9 @@ void ensureStreamNeatAndTidy(const struct RoseEngine *t, char *state,
 
 static really_inline
 void do_rebuild(const struct RoseEngine *t, struct hs_scratch *scratch) {
+    assert(t->drmatcherOffset);
     assert(!can_stop_matching(scratch));
 
-    if (!t->drmatcherOffset) {
-        DEBUG_PRINTF("no delayed rebuild table\n");
-        return;
-    }
-
     const struct HWLM *hwlm = getByOffset(t, t->drmatcherOffset);
     size_t len = MIN(scratch->core_info.hlen, t->delayRebuildLength);
     const u8 *buf = scratch->core_info.hbuf + scratch->core_info.hlen - len;
@@ -641,17 +637,14 @@ void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch) {
                      rebuild, scratch->core_info.status,
                      t->maxFloatingDelayedMatch, offset);
 
-        if (!flen) {
-            if (rebuild) { /* rebuild floating delayed match stuff */
-                do_rebuild(t, scratch);
-            }
-            goto flush_delay_and_exit;
-        }
-
         if (rebuild) { /* rebuild floating delayed match stuff */
             do_rebuild(t, scratch);
         }
 
+        if (!flen) {
+            goto flush_delay_and_exit;
+        }
+
         if (flen + offset <= t->floatingMinDistance) {
             DEBUG_PRINTF("skip FLOATING: before floating min\n");
             goto flush_delay_and_exit;