Skip to content

Commit

Permalink
remove check for Windows in get_domain_id_from_env()
Browse files Browse the repository at this point in the history
  • Loading branch information
suyashb95 committed Feb 13, 2020
1 parent 3be919f commit 2e0a505
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions rclcpp/src/rclcpp/node_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,21 +309,14 @@ NodeOptions::allocator(rcl_allocator_t allocator)
return *this;
}

// TODO(wjwwood): reuse rcutils_get_env() to avoid code duplication.
// See also: https://github.com/ros2/rcl/issues/119
size_t
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();
const char * ros_domain_id = nullptr;
const char * env_var = "ROS_DOMAIN_ID";
#ifndef _WIN32
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);
#endif

if (ros_domain_id) {
uint32_t number = strtoul(ros_domain_id, NULL, 0);
if (number == (std::numeric_limits<uint32_t>::max)()) {
Expand Down

0 comments on commit 2e0a505

Please sign in to comment.