MCPcopy Create free account
hub / github.com/MikeLankamp/fpm / BoolFromEnv

Function BoolFromEnv

3rdparty/googlebench/src/commandlineflags.cc:95–100  ·  view source on GitHub ↗

Reads and returns the Boolean environment variable corresponding to the given flag; if it's not set, returns default_value. The value is considered true iff it's not "0".

Source from the content-addressed store, hash-verified

93//
94// The value is considered true iff it's not "0".
95bool BoolFromEnv(const char* flag, bool default_value) {
96 const std::string env_var = FlagToEnvVar(flag);
97 const char* const string_value = getenv(env_var.c_str());
98 return string_value == nullptr ? default_value
99 : strcmp(string_value, "0") != 0;
100}
101
102// Reads and returns a 32-bit integer stored in the environment
103// variable corresponding to the given flag; if it isn't set or

Callers

nothing calls this directly

Calls 1

FlagToEnvVarFunction · 0.70

Tested by

no test coverage detected