@@ -71,14 +71,7 @@ rcl_expand_topic_name(
7171 rmw_ret = rmw_validate_node_name (node_name , & validation_result , NULL );
7272 if (rmw_ret != RMW_RET_OK ) {
7373 RCL_SET_ERROR_MSG (rmw_get_error_string ().str );
74- switch (rmw_ret ) {
75- case RMW_RET_INVALID_ARGUMENT :
76- return RCL_RET_INVALID_ARGUMENT ;
77- case RMW_RET_ERROR :
78- // fall through on purpose
79- default :
80- return RCL_RET_ERROR ;
81- }
74+ return rcl_convert_rmw_ret_to_rcl_ret (rmw_ret );
8275 }
8376 if (validation_result != RMW_NODE_NAME_VALID ) {
8477 RCL_SET_ERROR_MSG ("node name is invalid" );
@@ -88,14 +81,7 @@ rcl_expand_topic_name(
8881 rmw_ret = rmw_validate_namespace (node_namespace , & validation_result , NULL );
8982 if (rmw_ret != RMW_RET_OK ) {
9083 RCL_SET_ERROR_MSG (rmw_get_error_string ().str );
91- switch (rmw_ret ) {
92- case RMW_RET_INVALID_ARGUMENT :
93- return RCL_RET_INVALID_ARGUMENT ;
94- case RMW_RET_ERROR :
95- // fall through on purpose
96- default :
97- return RCL_RET_ERROR ;
98- }
84+ return rcl_convert_rmw_ret_to_rcl_ret (rmw_ret );
9985 }
10086 if (validation_result != RMW_NODE_NAME_VALID ) {
10187 RCL_SET_ERROR_MSG ("node namespace is invalid" );
@@ -220,15 +206,6 @@ rcl_expand_topic_name(
220206 return RCL_RET_BAD_ALLOC ;
221207 }
222208 }
223- // if the original input_topic_name has not yet be copied into new memory, strdup it now
224- if (!local_output ) {
225- local_output = rcutils_strdup (input_topic_name , allocator );
226- if (!local_output ) {
227- * output_topic_name = NULL ;
228- RCL_SET_ERROR_MSG ("failed to allocate memory for output topic" );
229- return RCL_RET_BAD_ALLOC ;
230- }
231- }
232209 // finally store the result in the out pointer and return
233210 * output_topic_name = local_output ;
234211 return RCL_RET_OK ;
0 commit comments