Skip to content

Commit

Permalink
Nit.
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Lihui <[email protected]>
  • Loading branch information
Chen Lihui authored and Chen Lihui committed Feb 2, 2021
1 parent 13b0dde commit 6ef26c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions rcl/include/rcl/subscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ rcl_subscription_is_cft_supported(const rcl_subscription_t * subscription);
* \return `RCL_RET_INVALID_ARGUMENT` if `filter_expression` is NULL, or
* \return `RCL_RET_INCORRECT_RMW_IMPLEMENTATION` if the `node` implementation
* identifier does not match this implementation, or
* \return `RCL_RET_UNSUPPORTED` if the implementation does not support content filter topic, or
* \return `RCL_RET_ERROR` if an unspecified error occurs.
*/
RCL_PUBLIC
Expand Down Expand Up @@ -322,6 +323,7 @@ rcl_subscription_set_cft_expression_parameters(
* \return `RCL_RET_INCORRECT_RMW_IMPLEMENTATION` if the `node` implementation
* identifier does not match this implementation, or
* \return `RCL_RET_BAD_ALLOC` if memory allocation fails, or
* \return `RCL_RET_UNSUPPORTED` if the implementation does not support content filter topic, or
* \return `RCL_RET_ERROR` if an unspecified error occurs.
*/
RCL_PUBLIC
Expand Down
11 changes: 7 additions & 4 deletions rcl/src/rcl/subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ rcl_subscription_options_copy(
goto clean;
}

dst->rmw_subscription_options.expression_parameters = parameters;

rcutils_ret_t ret = rcutils_string_array_init(
parameters, src->rmw_subscription_options.expression_parameters->size, allocator);
if (RCUTILS_RET_OK != ret) {
Expand All @@ -270,8 +272,6 @@ rcl_subscription_options_copy(
}
parameters->data[i] = parameter;
}

dst->rmw_subscription_options.expression_parameters = parameters;
}

return RCL_RET_OK;
Expand Down Expand Up @@ -300,7 +300,9 @@ rcl_subscription_options_fini(rcl_subscription_options_t * option)
if (option->rmw_subscription_options.expression_parameters) {
rcutils_ret_t ret = rcutils_string_array_fini(
option->rmw_subscription_options.expression_parameters);
assert(ret == RCUTILS_RET_OK);
if (RCUTILS_RET_OK != ret) {
RCUTILS_SAFE_FWRITE_TO_STDERR("Failed to fini string array.\n");
}
allocator->deallocate(option->rmw_subscription_options.expression_parameters, allocator->state);
option->rmw_subscription_options.expression_parameters = NULL;
}
Expand All @@ -311,7 +313,8 @@ bool
rcl_subscription_is_cft_supported(const rcl_subscription_t * subscription)
{
if (!rcl_subscription_is_valid(subscription)) {
return false; // error message already set
rcl_reset_error();
return false;
}
return subscription->impl->rmw_handle->is_cft_supported;
}
Expand Down

0 comments on commit 6ef26c8

Please sign in to comment.