]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
hsbench: don't create the greybox in release build
authorMatthew Barr <matthew.barr@intel.com>
Tue, 7 Mar 2017 05:06:46 +0000 (16:06 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 26 Apr 2017 05:16:36 +0000 (15:16 +1000)
tools/hsbench/main.cpp

index a99760a2e4e5ccde451138773956b6871be508b1..a37d48394652b98f23b29058a630fb3843c3a046 100644 (file)
@@ -194,7 +194,7 @@ struct BenchmarkSigs {
 /** Process command-line arguments. Prints usage and exits on error. */
 static
 void processArgs(int argc, char *argv[], vector<BenchmarkSigs> &sigSets,
-                 UNUSED Grey &grey) {
+                 UNUSED unique_ptr<Grey> &grey) {
     const char options[] = "-b:c:Cd:e:E:G:hi:n:No:p:sT:Vw:z:";
     int in_sigfile = 0;
     int do_per_scan = 0;
@@ -251,7 +251,7 @@ void processArgs(int argc, char *argv[], vector<BenchmarkSigs> &sigSets,
             break;
 #ifndef RELEASE_BUILD
         case 'G':
-            applyGreyOverrides(&grey, string(optarg));
+            applyGreyOverrides(grey.get(), string(optarg));
             break;
 #endif
         case 'h':
@@ -735,8 +735,10 @@ void runBenchmark(const EngineHyperscan &db,
 
 /** Main driver. */
 int main(int argc, char *argv[]) {
-    Grey grey;
-
+    unique_ptr<Grey> grey;
+#if !defined(RELEASE_BUILD)
+    grey = make_unique<Grey>();
+#endif
     setlocale(LC_ALL, ""); // use the user's locale
 
 #ifndef NDEBUG
@@ -777,7 +779,7 @@ int main(int argc, char *argv[]) {
             continue;
         }
 
-        auto engine = buildEngineHyperscan(exprMap, scan_mode, s.name, grey);
+        auto engine = buildEngineHyperscan(exprMap, scan_mode, s.name, *grey);
         if (!engine) {
             printf("Error: expressions failed to compile.\n");
             exit(1);