Skip to content

Commit

Permalink
use rcutils_get_env instead of getenv() in node_options.cpp
Browse files Browse the repository at this point in the history
Signed-off-by: Suyash458 <suyash.behera458@gmail.com>
  • Loading branch information
suyashb95 committed Feb 13, 2020
1 parent 7c1721a commit 3be919f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rclcpp/src/rclcpp/node_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "rclcpp/logging.hpp"
#include "rclcpp/publisher_options.hpp"
#include "rclcpp/qos.hpp"
#include "rcutils/get_env.h"

using rclcpp::exceptions::throw_from_rcl_error;

Expand Down Expand Up @@ -315,10 +316,10 @@ NodeOptions::get_domain_id_from_env() const
{
// Determine the domain id based on the options and the ROS_DOMAIN_ID env variable.
size_t domain_id = std::numeric_limits<size_t>::max();
char * ros_domain_id = nullptr;
const char * ros_domain_id = nullptr;
const char * env_var = "ROS_DOMAIN_ID";
#ifndef _WIN32
ros_domain_id = getenv(env_var);
rcutils_get_env(env_var, &ros_domain_id);
#else
size_t ros_domain_id_size;
_dupenv_s(&ros_domain_id, &ros_domain_id_size, env_var);
Expand Down

0 comments on commit 3be919f

Please sign in to comment.