fix get_env_bool for "true"/"false" values (#1811)
authorVitaliy Cherepanov/AI Tools Lab /SRR/Engineer/삼성전자 <v.cherepanov@samsung.com>
Tue, 3 Jul 2018 09:46:26 +0000 (12:46 +0300)
committer박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Tue, 3 Jul 2018 09:46:26 +0000 (18:46 +0900)
* fix get_env_bool for "true"/"false" values

exception in case non int string passed

Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
* remove unused code

Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
libs/util/src/environment.cpp

index f9e12d0..4b18b40 100644 (file)
@@ -38,11 +38,9 @@ bool get_env_bool(const char *name, bool defaultValue)
   const char *value = std::getenv(name);
   if (value != nullptr)
   {
-    if (std::stoi(value))
-      return true;
-    if (!strcasecmp(value, "true"))
-      return true;
+    return std::stoi(value) != 0;
   }
+
   return defaultValue;
 }