Short-circuit hasDebugFlag to make it a bit faster in the common case

This commit is contained in:
Ryan Prichard 2016-04-10 17:02:32 -05:00
parent 3e75255e6b
commit ef339dcdd1

View File

@ -123,7 +123,11 @@ bool hasDebugFlag(const char *flag)
trace("INTERNAL ERROR: hasDebugFlag flag has comma: '%s'", flag);
abort();
}
std::string config(getDebugConfig());
const char *const configCStr = getDebugConfig();
if (configCStr[0] == '\0') {
return false;
}
std::string config(configCStr);
std::string flagStr(flag);
config = "," + config + ",";
flagStr = "," + flagStr + ",";