From ce6a10ef58f974cc3e5986afcd4dbe48dfbb21cd Mon Sep 17 00:00:00 2001 From: Matthew Barr Date: Tue, 7 Mar 2017 16:06:46 +1100 Subject: [PATCH] hsbench: don't create the greybox in release build --- tools/hsbench/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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);