Skip to content

Commit

Permalink
minor fixes to getenv helper
Browse files Browse the repository at this point in the history
  • Loading branch information
jncfa committed Aug 1, 2024
1 parent 52dc00e commit 842c0cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ros2_spdlog_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ ROS2_SPDLOG_LOGGER_LOCAL bool getenv_value(const std::string_view env, const boo

std::string lowered_env = env_value.value();

std::transform(lowered_env.begin(), lowered_env.end(), lowered_env.begin(),
[](unsigned char c){ return std::tolower(c); });
std::for_each(lowered_env.begin(), lowered_env.end(), [](unsigned char c){ return std::tolower(c); });

if (env_value->compare("0") == 0 || env_value->compare("false") == 0){
if (lowered_env == "0" || lowered_env == "false"){
return false;
}
else if (env_value->compare("1") == 0 || env_value->compare("true") == 0){
else if (lowered_env == "1" || lowered_env == "true"){
return true;
}

Expand Down

0 comments on commit 842c0cf

Please sign in to comment.