From: Matthew Barr Date: Tue, 7 Mar 2017 05:06:46 +0000 (+1100) Subject: hsbench: don't create the greybox in release build X-Git-Tag: v4.5.0^2~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce6a10ef58f974cc3e5986afcd4dbe48dfbb21cd;p=thirdparty%2Fvectorscan.git hsbench: don't create the greybox in release build --- diff --git a/tools/hsbench/main.cpp b/tools/hsbench/main.cpp index a99760a2..a37d4839 100644 --- a/tools/hsbench/main.cpp +++ b/tools/hsbench/main.cpp @@ -194,7 +194,7 @@ struct BenchmarkSigs { /** Process command-line arguments. Prints usage and exits on error. */ static void processArgs(int argc, char *argv[], vector &sigSets, - UNUSED Grey &grey) { + UNUSED unique_ptr &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 &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; +#if !defined(RELEASE_BUILD) + grey = make_unique(); +#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);