hsbench: don't create the greybox in release build

This commit is contained in:
Matthew Barr 2017-03-07 16:06:46 +11:00
parent 533fcf383d
commit ce6a10ef58

View File

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