Skip to content

Commit

Permalink
use semicolons after macros
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodall <william@osrfoundation.org>
  • Loading branch information
wjwwood committed Oct 31, 2018
1 parent 1b3de50 commit a440a20
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 48 deletions.
6 changes: 3 additions & 3 deletions rcl/src/rcl/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ rcl_client_init(
rcutils_string_map_t substitutions_map = rcutils_get_zero_initialized_string_map();
rcutils_ret_t rcutils_ret = rcutils_string_map_init(&substitutions_map, 0, rcutils_allocator);
if (rcutils_ret != RCUTILS_RET_OK) {
RCL_SET_ERROR_MSG(rcutils_get_error_string().str)
RCL_SET_ERROR_MSG(rcutils_get_error_string().str);
if (rcutils_ret == RCUTILS_RET_BAD_ALLOC) {
return RCL_RET_BAD_ALLOC;
}
Expand Down Expand Up @@ -111,7 +111,7 @@ rcl_client_init(
&expanded_service_name);
rcutils_ret = rcutils_string_map_fini(&substitutions_map);
if (rcutils_ret != RCUTILS_RET_OK) {
RCL_SET_ERROR_MSG(rcutils_get_error_string().str)
RCL_SET_ERROR_MSG(rcutils_get_error_string().str);
allocator->deallocate(expanded_service_name, allocator->state);
return RCL_RET_ERROR;
}
Expand Down Expand Up @@ -153,7 +153,7 @@ rcl_client_init(
goto cleanup;
}
if (validation_result != RMW_TOPIC_VALID) {
RCL_SET_ERROR_MSG(rmw_full_topic_name_validation_result_string(validation_result))
RCL_SET_ERROR_MSG(rmw_full_topic_name_validation_result_string(validation_result));
ret = RCL_RET_SERVICE_NAME_INVALID;
goto cleanup;
}
Expand Down
34 changes: 17 additions & 17 deletions rcl/src/rcl/expand_topic_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ rcl_expand_topic_name(
char ** output_topic_name)
{
// check arguments that could be null
RCL_CHECK_ARGUMENT_FOR_NULL(input_topic_name, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(node_name, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(node_namespace, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(substitutions, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(output_topic_name, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(input_topic_name, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(node_name, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(node_namespace, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(substitutions, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(output_topic_name, RCL_RET_INVALID_ARGUMENT);
// validate the input topic
int validation_result;
rcl_ret_t ret = rcl_validate_topic_name(input_topic_name, &validation_result, NULL);
Expand All @@ -63,14 +63,14 @@ rcl_expand_topic_name(
return ret;
}
if (validation_result != RCL_TOPIC_NAME_VALID) {
RCL_SET_ERROR_MSG("topic name is invalid")
RCL_SET_ERROR_MSG("topic name is invalid");
return RCL_RET_TOPIC_NAME_INVALID;
}
// validate the node name
rmw_ret_t rmw_ret;
rmw_ret = rmw_validate_node_name(node_name, &validation_result, NULL);
if (rmw_ret != RMW_RET_OK) {
RCL_SET_ERROR_MSG(rmw_get_error_string().str)
RCL_SET_ERROR_MSG(rmw_get_error_string().str);
switch (rmw_ret) {
case RMW_RET_INVALID_ARGUMENT:
return RCL_RET_INVALID_ARGUMENT;
Expand All @@ -81,13 +81,13 @@ rcl_expand_topic_name(
}
}
if (validation_result != RMW_NODE_NAME_VALID) {
RCL_SET_ERROR_MSG("node name is invalid")
RCL_SET_ERROR_MSG("node name is invalid");
return RCL_RET_NODE_INVALID_NAME;
}
// validate the namespace
rmw_ret = rmw_validate_namespace(node_namespace, &validation_result, NULL);
if (rmw_ret != RMW_RET_OK) {
RCL_SET_ERROR_MSG(rmw_get_error_string().str)
RCL_SET_ERROR_MSG(rmw_get_error_string().str);
switch (rmw_ret) {
case RMW_RET_INVALID_ARGUMENT:
return RCL_RET_INVALID_ARGUMENT;
Expand All @@ -98,7 +98,7 @@ rcl_expand_topic_name(
}
}
if (validation_result != RMW_NODE_NAME_VALID) {
RCL_SET_ERROR_MSG("node namespace is invalid")
RCL_SET_ERROR_MSG("node namespace is invalid");
return RCL_RET_NODE_INVALID_NAMESPACE;
}
// check if the topic has substitutions to be made
Expand All @@ -111,7 +111,7 @@ rcl_expand_topic_name(
*output_topic_name = rcutils_strdup(input_topic_name, allocator);
if (!*output_topic_name) {
*output_topic_name = NULL;
RCL_SET_ERROR_MSG("failed to allocate memory for output topic")
RCL_SET_ERROR_MSG("failed to allocate memory for output topic");
return RCL_RET_BAD_ALLOC;
}
return RCL_RET_OK;
Expand All @@ -126,7 +126,7 @@ rcl_expand_topic_name(
rcutils_format_string(allocator, fmt, node_namespace, node_name, input_topic_name + 1);
if (!local_output) {
*output_topic_name = NULL;
RCL_SET_ERROR_MSG("failed to allocate memory for output topic")
RCL_SET_ERROR_MSG("failed to allocate memory for output topic");
return RCL_RET_BAD_ALLOC;
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ rcl_expand_topic_name(
rcutils_strndup(next_opening_brace, substitution_substr_len, allocator);
if (!next_substitution) {
*output_topic_name = NULL;
RCL_SET_ERROR_MSG("failed to allocate memory for substitution")
RCL_SET_ERROR_MSG("failed to allocate memory for substitution");
allocator.deallocate(local_output, allocator.state);
return RCL_RET_BAD_ALLOC;
}
Expand All @@ -193,7 +193,7 @@ rcl_expand_topic_name(
allocator.deallocate(original_local_output, allocator.state); // free no matter what
if (!local_output) {
*output_topic_name = NULL;
RCL_SET_ERROR_MSG("failed to allocate memory for expanded topic")
RCL_SET_ERROR_MSG("failed to allocate memory for expanded topic");
return RCL_RET_BAD_ALLOC;
}
current_output = local_output;
Expand All @@ -216,7 +216,7 @@ rcl_expand_topic_name(
}
if (!local_output) {
*output_topic_name = NULL;
RCL_SET_ERROR_MSG("failed to allocate memory for output topic")
RCL_SET_ERROR_MSG("failed to allocate memory for output topic");
return RCL_RET_BAD_ALLOC;
}
}
Expand All @@ -225,7 +225,7 @@ rcl_expand_topic_name(
local_output = rcutils_strdup(input_topic_name, allocator);
if (!local_output) {
*output_topic_name = NULL;
RCL_SET_ERROR_MSG("failed to allocate memory for output topic")
RCL_SET_ERROR_MSG("failed to allocate memory for output topic");
return RCL_RET_BAD_ALLOC;
}
}
Expand All @@ -237,7 +237,7 @@ rcl_expand_topic_name(
rcl_ret_t
rcl_get_default_topic_name_substitutions(rcutils_string_map_t * string_map)
{
RCL_CHECK_ARGUMENT_FOR_NULL(string_map, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(string_map, RCL_RET_INVALID_ARGUMENT);

// right now there are no default substitutions

Expand Down
5 changes: 3 additions & 2 deletions rcl/src/rcl/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ rcl_get_topic_names_and_types(
bool no_demangle,
rcl_names_and_types_t * topic_names_and_types)
{
RCL_CHECK_ARGUMENT_FOR_NULL(allocator, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(allocator, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT);
if (!rcl_node_is_valid(node)) {
return RCL_RET_NODE_INVALID;
}
RCL_CHECK_ARGUMENT_FOR_NULL(topic_names_and_types, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(topic_names_and_types, RCL_RET_INVALID_ARGUMENT);
rmw_ret_t rmw_ret;
rmw_ret = rmw_names_and_types_check_zero(topic_names_and_types);
if (rmw_ret != RMW_RET_OK) {
Expand Down Expand Up @@ -119,6 +119,7 @@ rcl_get_node_names(
RCL_SET_ERROR_MSG("node_namespaces is not null");
return RCL_RET_INVALID_ARGUMENT;
}
(void)allocator; // to be used in rmw_get_node_names in the future
rmw_ret_t rmw_ret = rmw_get_node_names(
rcl_node_get_rmw_handle(node),
node_names,
Expand Down
4 changes: 2 additions & 2 deletions rcl/src/rcl/publisher.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ rcl_publisher_init(
rcutils_string_map_t substitutions_map = rcutils_get_zero_initialized_string_map();
rcutils_ret_t rcutils_ret = rcutils_string_map_init(&substitutions_map, 0, rcutils_allocator);
if (rcutils_ret != RCUTILS_RET_OK) {
RCL_SET_ERROR_MSG(rcutils_get_error_string().str)
RCL_SET_ERROR_MSG(rcutils_get_error_string().str);
if (rcutils_ret == RCUTILS_RET_BAD_ALLOC) {
return RCL_RET_BAD_ALLOC;
}
Expand Down Expand Up @@ -151,7 +151,7 @@ rcl_publisher_init(
goto cleanup;
}
if (validation_result != RMW_TOPIC_VALID) {
RCL_SET_ERROR_MSG(rmw_full_topic_name_validation_result_string(validation_result))
RCL_SET_ERROR_MSG(rmw_full_topic_name_validation_result_string(validation_result));
ret = RCL_RET_TOPIC_NAME_INVALID;
goto cleanup;
}
Expand Down
6 changes: 3 additions & 3 deletions rcl/src/rcl/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ rcl_service_init(
rcutils_string_map_t substitutions_map = rcutils_get_zero_initialized_string_map();
rcutils_ret_t rcutils_ret = rcutils_string_map_init(&substitutions_map, 0, rcutils_allocator);
if (rcutils_ret != RCUTILS_RET_OK) {
RCL_SET_ERROR_MSG(rcutils_get_error_string().str)
RCL_SET_ERROR_MSG(rcutils_get_error_string().str);
if (rcutils_ret == RCUTILS_RET_BAD_ALLOC) {
return RCL_RET_BAD_ALLOC;
}
Expand Down Expand Up @@ -108,7 +108,7 @@ rcl_service_init(
&expanded_service_name);
rcutils_ret = rcutils_string_map_fini(&substitutions_map);
if (rcutils_ret != RCUTILS_RET_OK) {
RCL_SET_ERROR_MSG(rcutils_get_error_string().str)
RCL_SET_ERROR_MSG(rcutils_get_error_string().str);
ret = RCL_RET_ERROR;
goto cleanup;
return RCL_RET_ERROR;
Expand Down Expand Up @@ -151,7 +151,7 @@ rcl_service_init(
goto cleanup;
}
if (validation_result != RMW_TOPIC_VALID) {
RCL_SET_ERROR_MSG(rmw_full_topic_name_validation_result_string(validation_result))
RCL_SET_ERROR_MSG(rmw_full_topic_name_validation_result_string(validation_result));
ret = RCL_RET_SERVICE_NAME_INVALID;
goto cleanup;
}
Expand Down
6 changes: 3 additions & 3 deletions rcl/src/rcl/subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ rcl_subscription_init(
rcutils_string_map_t substitutions_map = rcutils_get_zero_initialized_string_map();
rcutils_ret_t rcutils_ret = rcutils_string_map_init(&substitutions_map, 0, rcutils_allocator);
if (rcutils_ret != RCUTILS_RET_OK) {
RCL_SET_ERROR_MSG(rcutils_get_error_string().str)
RCL_SET_ERROR_MSG(rcutils_get_error_string().str);
if (rcutils_ret == RCUTILS_RET_BAD_ALLOC) {
return RCL_RET_BAD_ALLOC;
}
Expand Down Expand Up @@ -107,7 +107,7 @@ rcl_subscription_init(
&expanded_topic_name);
rcutils_ret = rcutils_string_map_fini(&substitutions_map);
if (rcutils_ret != RCUTILS_RET_OK) {
RCL_SET_ERROR_MSG(rcutils_get_error_string().str)
RCL_SET_ERROR_MSG(rcutils_get_error_string().str);
ret = RCL_RET_ERROR;
goto cleanup;
}
Expand Down Expand Up @@ -149,7 +149,7 @@ rcl_subscription_init(
goto cleanup;
}
if (validation_result != RMW_TOPIC_VALID) {
RCL_SET_ERROR_MSG(rmw_full_topic_name_validation_result_string(validation_result))
RCL_SET_ERROR_MSG(rmw_full_topic_name_validation_result_string(validation_result));
ret = RCL_RET_TOPIC_NAME_INVALID;
goto cleanup;
}
Expand Down
14 changes: 7 additions & 7 deletions rcl/src/rcl/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,12 @@ rcl_enable_ros_time_override(rcl_clock_t * clock)
{
RCL_CHECK_ARGUMENT_FOR_NULL(clock, RCL_RET_INVALID_ARGUMENT);
if (clock->type != RCL_ROS_TIME) {
RCL_SET_ERROR_MSG("Clock is not of type RCL_ROS_TIME, cannot enable override.")
RCL_SET_ERROR_MSG("Clock is not of type RCL_ROS_TIME, cannot enable override.");
return RCL_RET_ERROR;
}
rcl_ros_clock_storage_t * storage = (rcl_ros_clock_storage_t *)clock->data;
if (!storage) {
RCL_SET_ERROR_MSG("Clock storage is not initialized, cannot enable override.")
RCL_SET_ERROR_MSG("Clock storage is not initialized, cannot enable override.");
return RCL_RET_ERROR;
}
if (!storage->active) {
Expand All @@ -308,13 +308,13 @@ rcl_disable_ros_time_override(rcl_clock_t * clock)
{
RCL_CHECK_ARGUMENT_FOR_NULL(clock, RCL_RET_INVALID_ARGUMENT);
if (clock->type != RCL_ROS_TIME) {
RCL_SET_ERROR_MSG("Clock is not of type RCL_ROS_TIME, cannot disable override.")
RCL_SET_ERROR_MSG("Clock is not of type RCL_ROS_TIME, cannot disable override.");
return RCL_RET_ERROR;
}
rcl_ros_clock_storage_t * storage = \
(rcl_ros_clock_storage_t *)clock->data;
if (!storage) {
RCL_SET_ERROR_MSG("Clock storage is not initialized, cannot disable override.")
RCL_SET_ERROR_MSG("Clock storage is not initialized, cannot disable override.");
return RCL_RET_ERROR;
}
if (storage->active) {
Expand All @@ -336,13 +336,13 @@ rcl_is_enabled_ros_time_override(
RCL_CHECK_ARGUMENT_FOR_NULL(clock, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(is_enabled, RCL_RET_INVALID_ARGUMENT);
if (clock->type != RCL_ROS_TIME) {
RCL_SET_ERROR_MSG("Clock is not of type RCL_ROS_TIME, cannot query override state.")
RCL_SET_ERROR_MSG("Clock is not of type RCL_ROS_TIME, cannot query override state.");
return RCL_RET_ERROR;
}
rcl_ros_clock_storage_t * storage = \
(rcl_ros_clock_storage_t *)clock->data;
if (!storage) {
RCL_SET_ERROR_MSG("Clock storage is not initialized, cannot query override state.")
RCL_SET_ERROR_MSG("Clock storage is not initialized, cannot query override state.");
return RCL_RET_ERROR;
}
*is_enabled = storage->active;
Expand All @@ -356,7 +356,7 @@ rcl_set_ros_time_override(
{
RCL_CHECK_ARGUMENT_FOR_NULL(clock, RCL_RET_INVALID_ARGUMENT);
if (clock->type != RCL_ROS_TIME) {
RCL_SET_ERROR_MSG("Clock is not of type RCL_ROS_TIME, cannot set time override.")
RCL_SET_ERROR_MSG("Clock is not of type RCL_ROS_TIME, cannot set time override.");
return RCL_RET_ERROR;
}
rcl_time_jump_t time_jump;
Expand Down
6 changes: 3 additions & 3 deletions rcl/src/rcl/validate_topic_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ rcl_validate_topic_name(
int * validation_result,
size_t * invalid_index)
{
RCL_CHECK_ARGUMENT_FOR_NULL(topic_name, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(topic_name, RCL_RET_INVALID_ARGUMENT);
return rcl_validate_topic_name_with_size(
topic_name, strlen(topic_name), validation_result, invalid_index);
}
Expand All @@ -44,8 +44,8 @@ rcl_validate_topic_name_with_size(
int * validation_result,
size_t * invalid_index)
{
RCL_CHECK_ARGUMENT_FOR_NULL(topic_name, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(validation_result, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(topic_name, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(validation_result, RCL_RET_INVALID_ARGUMENT);

if (topic_name_length == 0) {
*validation_result = RCL_TOPIC_NAME_INVALID_IS_EMPTY_STRING;
Expand Down
16 changes: 8 additions & 8 deletions rcl_lifecycle/src/com_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ rcl_lifecycle_com_interface_init(
const rosidl_service_type_support_t * ts_srv_get_available_transitions,
const rosidl_service_type_support_t * ts_srv_get_transition_graph)
{
RCL_CHECK_ARGUMENT_FOR_NULL(com_interface, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(node_handle, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(ts_pub_notify, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(ts_srv_change_state, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(ts_srv_get_state, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(ts_srv_get_available_states, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(ts_srv_get_available_transitions, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(ts_srv_get_transition_graph, RCL_RET_INVALID_ARGUMENT)
RCL_CHECK_ARGUMENT_FOR_NULL(com_interface, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(node_handle, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(ts_pub_notify, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(ts_srv_change_state, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(ts_srv_get_state, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(ts_srv_get_available_states, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(ts_srv_get_available_transitions, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(ts_srv_get_transition_graph, RCL_RET_INVALID_ARGUMENT);

// initialize publisher
{
Expand Down

0 comments on commit a440a20

Please sign in to comment.