Skip to content

Commit e09008b

Browse files
committed
Address peer review comments
Signed-off-by: Ivan Santiago Paunovic <[email protected]>
1 parent 3c2f89c commit e09008b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

rmw_cyclonedds_cpp/src/rmw_node.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3038,7 +3038,6 @@ static rmw_ret_t do_for_node_user_data(
30383038
}
30393039

30403040
extern "C" rmw_ret_t rmw_get_node_names_impl(
3041-
std::regex re,
30423041
const rmw_node_t * node,
30433042
rcutils_string_array_t * node_names,
30443043
rcutils_string_array_t * node_namespaces,
@@ -3052,13 +3051,17 @@ extern "C" rmw_ret_t rmw_get_node_names_impl(
30523051
return RMW_RET_ERROR;
30533052
}
30543053

3054+
std::regex re {
3055+
"^name=([^;]*);namespace=([^;]*);(securitycontext=([^;]*);)?",
3056+
std::regex_constants::extended
3057+
};
30553058
std::vector<std::tuple<std::string, std::string, std::string>> ns;
30563059
auto oper =
30573060
[&ns, re](const dds_builtintopic_participant_t & sample, const char * ud) -> bool {
30583061
std::cmatch cm;
30593062
static_cast<void>(sample);
30603063
if (std::regex_search(ud, cm, re)) {
3061-
ns.push_back(std::make_tuple(std::string(cm[1]), std::string(cm[2]), std::string(cm[3])));
3064+
ns.push_back(std::make_tuple(std::string(cm[1]), std::string(cm[2]), std::string(cm[4])));
30623065
}
30633066
return true;
30643067
};
@@ -3134,7 +3137,6 @@ extern "C" rmw_ret_t rmw_get_node_names(
31343137
rcutils_string_array_t * node_namespaces)
31353138
{
31363139
return rmw_get_node_names_impl(
3137-
std::regex("^name=([^;]*);namespace=([^;]*);securitycontext=([^;]*);", std::regex::extended),
31383140
node,
31393141
node_names,
31403142
node_namespaces,
@@ -3152,7 +3154,6 @@ extern "C" rmw_ret_t rmw_get_node_names_with_security_contexts(
31523154
return RMW_RET_ERROR;
31533155
}
31543156
return rmw_get_node_names_impl(
3155-
std::regex("^name=([^;]*);namespace=([^;]*);securitycontext=([^;]*);", std::regex::extended),
31563157
node,
31573158
node_names,
31583159
node_namespaces,

0 commit comments

Comments
 (0)