Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Include node namespaces in get_node_names #299

Merged
merged 4 commits into from
Sep 6, 2018

Conversation

mjcarroll
Copy link
Member

@mjcarroll mjcarroll commented Aug 28, 2018

Connects to ros2/rmw#142

@mjcarroll mjcarroll added the in progress Actively being worked on (Kanban column) label Aug 28, 2018

snprintf(reinterpret_cast<char *>(participant_qos.user_data.value.get_contiguous_buffer()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to check the return code of snprintf.

if (rcutils_ret != RCUTILS_RET_OK) {
RCUTILS_LOG_ERROR_NAMED(
"rmw_connext_cpp",
"failed to cleanup during error handling: %s", rcutils_get_error_string_safe())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to reset the error message here with rcutils_reset_error().

if (!node_namespaces->data[i]) {
RMW_SET_ERROR_MSG("could not allocate memory for node namespace")
rcutils_ret = rcutils_string_array_fini(node_names);
rcutils_ret = rcutils_string_array_fini(node_namespaces);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If both fail then you'll need to reset the error state between them, but then again, perhaps that's ok or even intentional.

Separately I'll say that rather than duplicating this cleanup code, I'd recommend using a label and a goto to have it happen in one place.

* Use goto to handle failure conditions.
* Check snprintf return.
@mjcarroll mjcarroll force-pushed the get_node_names_and_namespaces branch from c741336 to e0d1e0d Compare August 30, 2018 15:34
@mjcarroll mjcarroll merged commit 18f5722 into master Sep 6, 2018
@mjcarroll mjcarroll deleted the get_node_names_and_namespaces branch September 6, 2018 13:03
@mjcarroll mjcarroll removed the in progress Actively being worked on (Kanban column) label Sep 6, 2018
dabonnie pushed a commit to aws-ros-dev/rmw_connext that referenced this pull request Apr 3, 2019
* Include node namespaces in get_node_names.

* Address reviewer feedback.

* Use goto to handle failure conditions

* Fix typo.

Signed-off-by: Devin Bonnie <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants