]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
find_escape_strings: find outs2_broken faster
authorJustin Viiret <justin.viiret@intel.com>
Thu, 6 Apr 2017 06:14:43 +0000 (16:14 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Tue, 30 May 2017 03:47:20 +0000 (13:47 +1000)
src/nfa/accel_dfa_build_strat.cpp

index d257b530b8d3eb14821879f0e0804dad87dd087c..4bd83a52dabff563506a3462a62e4787bdcaf92e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -379,16 +379,18 @@ accel_dfa_build_strat::find_escape_strings(dstate_id_t this_idx) const {
                     for (auto jj = cr_all_j.find_first(); jj != CharReach::npos;
                          jj = cr_all_j.find_next(jj)) {
                         rv.double_byte.emplace((u8)ii, (u8)jj);
+                        if (rv.double_byte.size() > 8) {
+                            DEBUG_PRINTF("outs2 too big\n");
+                            outs2_broken = true;
+                            goto done;
+                        }
                     }
                 }
             }
         }
 
-        if (rv.double_byte.size() > 8) {
-            DEBUG_PRINTF("outs2 too big\n");
-            outs2_broken = true;
-        }
-
+    done:
+        assert(outs2_broken || rv.double_byte.size() <= 8);
         if (outs2_broken) {
             rv.double_byte.clear();
         }