Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macro semicolons #303

Merged
merged 2 commits into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions rcl/src/rcl/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ rcl_client_init(
RCL_CHECK_ARGUMENT_FOR_NULL(type_support, RCL_RET_INVALID_ARGUMENT, *allocator);
RCL_CHECK_ARGUMENT_FOR_NULL(service_name, RCL_RET_INVALID_ARGUMENT, *allocator);
RCUTILS_LOG_DEBUG_NAMED(
ROS_PACKAGE_NAME, "Initializing client for service name '%s'", service_name)
ROS_PACKAGE_NAME, "Initializing client for service name '%s'", service_name);
if (client->impl) {
RCL_SET_ERROR_MSG("client already initialized, or memory was unintialized", *allocator);
return RCL_RET_ALREADY_INIT;
Expand All @@ -93,7 +93,7 @@ rcl_client_init(
ROS_PACKAGE_NAME,
"failed to fini string_map (%d) during error handling: %s\n",
rcutils_ret,
rcutils_get_error_string_safe())
rcutils_get_error_string_safe());
}
if (ret == RCL_RET_BAD_ALLOC) {
return ret;
Expand Down Expand Up @@ -123,7 +123,7 @@ rcl_client_init(
}
goto cleanup;
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Expanded service name '%s'", expanded_service_name)
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Expanded service name '%s'", expanded_service_name);

const rcl_node_options_t * node_options = rcl_node_get_options(node);
if (NULL == node_options) {
Expand Down Expand Up @@ -176,7 +176,7 @@ rcl_client_init(
}
// options
client->impl->options = *options;
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client initialized")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client initialized");
ret = RCL_RET_OK;
goto cleanup;
fail:
Expand All @@ -199,7 +199,7 @@ rcl_ret_t
rcl_client_fini(rcl_client_t * client, rcl_node_t * node)
{
(void)node;
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing client")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing client");
rcl_ret_t result = RCL_RET_OK;
RCL_CHECK_ARGUMENT_FOR_NULL(client, RCL_RET_INVALID_ARGUMENT, rcl_get_default_allocator());
RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT, rcl_get_default_allocator());
Expand All @@ -219,7 +219,7 @@ rcl_client_fini(rcl_client_t * client, rcl_node_t * node)
}
allocator.deallocate(client->impl, allocator.state);
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client finalized")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client finalized");
return result;
}

Expand Down Expand Up @@ -266,7 +266,7 @@ rcl_client_get_rmw_handle(const rcl_client_t * client)
rcl_ret_t
rcl_send_request(const rcl_client_t * client, const void * ros_request, int64_t * sequence_number)
{
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client sending service request")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client sending service request");
if (!rcl_client_is_valid(client, NULL)) {
return RCL_RET_CLIENT_INVALID;
}
Expand All @@ -290,7 +290,7 @@ rcl_take_response(
rmw_request_id_t * request_header,
void * ros_response)
{
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client taking service response")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client taking service response");
if (!rcl_client_is_valid(client, NULL)) {
return RCL_RET_CLIENT_INVALID;
}
Expand All @@ -307,7 +307,7 @@ rcl_take_response(
return RCL_RET_ERROR;
}
RCUTILS_LOG_DEBUG_NAMED(
ROS_PACKAGE_NAME, "Client take response succeeded: %s", taken ? "true" : "false")
ROS_PACKAGE_NAME, "Client take response succeeded: %s", taken ? "true" : "false");
if (!taken) {
return RCL_RET_CLIENT_TAKE_FAILED;
}
Expand Down
18 changes: 9 additions & 9 deletions rcl/src/rcl/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ rcl_node_init(
RCL_CHECK_ARGUMENT_FOR_NULL(namespace_, RCL_RET_INVALID_ARGUMENT, *allocator);
RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT, *allocator);
RCUTILS_LOG_DEBUG_NAMED(
ROS_PACKAGE_NAME, "Initializing node '%s' in namespace '%s'", name, namespace_)
ROS_PACKAGE_NAME, "Initializing node '%s' in namespace '%s'", name, namespace_);
if (node->impl) {
RCL_SET_ERROR_MSG("node already initialized, or struct memory was unintialized", *allocator);
return RCL_RET_ALREADY_INIT;
Expand Down Expand Up @@ -281,7 +281,7 @@ rcl_node_init(
}
// actual domain id
node->impl->actual_domain_id = domain_id;
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Using domain ID of '%zu'", domain_id)
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Using domain ID of '%zu'", domain_id);

const char * ros_security_enable = NULL;
const char * ros_enforce_security = NULL;
Expand All @@ -296,7 +296,7 @@ rcl_node_init(

bool use_security = (0 == strcmp(ros_security_enable, "true"));
RCUTILS_LOG_DEBUG_NAMED(
ROS_PACKAGE_NAME, "Using security: %s", use_security ? "true" : "false")
ROS_PACKAGE_NAME, "Using security: %s", use_security ? "true" : "false");

if (rcutils_get_env(ROS_SECURITY_STRATEGY_VAR_NAME, &ros_enforce_security)) {
RCL_SET_ERROR_MSG(
Expand Down Expand Up @@ -359,7 +359,7 @@ rcl_node_init(
// error message already set
goto fail;
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Node initialized")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Node initialized");
ret = RCL_RET_OK;
goto cleanup;
fail:
Expand All @@ -373,7 +373,7 @@ rcl_node_init(
RCUTILS_LOG_ERROR_NAMED(
ROS_PACKAGE_NAME,
"failed to fini rmw node in error recovery: %s", rmw_get_error_string_safe()
)
);
}
}
if (node->impl->graph_guard_condition) {
Expand All @@ -382,7 +382,7 @@ rcl_node_init(
RCUTILS_LOG_ERROR_NAMED(
ROS_PACKAGE_NAME,
"failed to fini guard condition in error recovery: %s", rcl_get_error_string_safe()
)
);
}
allocator->deallocate(node->impl->graph_guard_condition, allocator->state);
}
Expand All @@ -392,7 +392,7 @@ rcl_node_init(
RCUTILS_LOG_ERROR_NAMED(
ROS_PACKAGE_NAME,
"failed to fini arguments in error recovery: %s", rcl_get_error_string_safe()
)
);
}
}
allocator->deallocate(node->impl, allocator->state);
Expand All @@ -415,7 +415,7 @@ rcl_node_init(
rcl_ret_t
rcl_node_fini(rcl_node_t * node)
{
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing node")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing node");
RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT, rcl_get_default_allocator());
if (!node->impl) {
// Repeat calls to fini or calling fini on a zero initialized node is ok.
Expand Down Expand Up @@ -444,7 +444,7 @@ rcl_node_fini(rcl_node_t * node)
}
allocator.deallocate(node->impl, allocator.state);
node->impl = NULL;
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Node finalized")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Node finalized");
return result;
}

Expand Down
12 changes: 6 additions & 6 deletions rcl/src/rcl/publisher.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ rcl_publisher_init(
RCL_CHECK_ARGUMENT_FOR_NULL(type_support, RCL_RET_INVALID_ARGUMENT, *allocator);
RCL_CHECK_ARGUMENT_FOR_NULL(topic_name, RCL_RET_INVALID_ARGUMENT, *allocator);
RCUTILS_LOG_DEBUG_NAMED(
ROS_PACKAGE_NAME, "Initializing publisher for topic name '%s'", topic_name)
ROS_PACKAGE_NAME, "Initializing publisher for topic name '%s'", topic_name);
// Expand the given topic name.
rcutils_allocator_t rcutils_allocator = *allocator; // implicit conversion to rcutils version
rcutils_string_map_t substitutions_map = rcutils_get_zero_initialized_string_map();
Expand All @@ -92,7 +92,7 @@ rcl_publisher_init(
ROS_PACKAGE_NAME,
"failed to fini string_map (%d) during error handling: %s",
rcutils_ret,
rcutils_get_error_string_safe())
rcutils_get_error_string_safe());
}
if (ret == RCL_RET_BAD_ALLOC) {
return ret;
Expand Down Expand Up @@ -122,7 +122,7 @@ rcl_publisher_init(
}
goto cleanup;
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Expanded topic name '%s'", expanded_topic_name)
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Expanded topic name '%s'", expanded_topic_name);

const rcl_node_options_t * node_options = rcl_node_get_options(node);
if (NULL == node_options) {
Expand Down Expand Up @@ -200,7 +200,7 @@ rcl_publisher_fini(rcl_publisher_t * publisher, rcl_node_t * node)
if (!rcl_node_is_valid(node, NULL)) {
return RCL_RET_NODE_INVALID;
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing publisher")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing publisher");
if (publisher->impl) {
rcl_allocator_t allocator = publisher->impl->options.allocator;
rmw_node_t * rmw_node = rcl_node_get_rmw_handle(node);
Expand All @@ -215,7 +215,7 @@ rcl_publisher_fini(rcl_publisher_t * publisher, rcl_node_t * node)
}
allocator.deallocate(publisher->impl, allocator.state);
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Publisher finalized")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Publisher finalized");
return result;
}

Expand All @@ -233,7 +233,7 @@ rcl_publisher_get_default_options()
rcl_ret_t
rcl_publish(const rcl_publisher_t * publisher, const void * ros_message)
{
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Publisher publishing message")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Publisher publishing message");
if (!rcl_publisher_is_valid(publisher, NULL)) {
return RCL_RET_PUBLISHER_INVALID;
}
Expand Down
2 changes: 1 addition & 1 deletion rcl/src/rcl/rcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ rcl_init(int argc, char const * const * argv, rcl_allocator_t allocator)
rcl_ret_t
rcl_shutdown()
{
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Shutting down")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Shutting down");
if (!rcl_ok()) {
// must use default allocator here because __rcl_allocator may not be set yet
RCL_SET_ERROR_MSG("rcl_shutdown called before rcl_init", rcl_get_default_allocator());
Expand Down
14 changes: 7 additions & 7 deletions rcl/src/rcl/rmw_implementation_identifier_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ INITIALIZER(initialize) {
ROS_PACKAGE_NAME,
"Error getting environment variable 'RMW_IMPLEMENTATION': %s",
rcl_get_error_string_safe()
)
);
exit(ret);
}
if (strlen(expected_rmw_impl_env) > 0) {
// Copy the environment variable so it doesn't get over-written by the next getenv call.
expected_rmw_impl = rcutils_strdup(expected_rmw_impl_env, allocator);
if (!expected_rmw_impl) {
RCUTILS_LOG_ERROR_NAMED(ROS_PACKAGE_NAME, "allocation failed")
RCUTILS_LOG_ERROR_NAMED(ROS_PACKAGE_NAME, "allocation failed");
exit(RCL_RET_BAD_ALLOC);
}
}
Expand All @@ -85,14 +85,14 @@ INITIALIZER(initialize) {
ROS_PACKAGE_NAME,
"Error getting environment variable 'RCL_ASSERT_RMW_ID_MATCHES': %s",
rcl_get_error_string_safe()
)
);
exit(ret);
}
if (strlen(asserted_rmw_impl_env) > 0) {
// Copy the environment variable so it doesn't get over-written by the next getenv call.
asserted_rmw_impl = rcutils_strdup(asserted_rmw_impl_env, allocator);
if (!asserted_rmw_impl) {
RCUTILS_LOG_ERROR_NAMED(ROS_PACKAGE_NAME, "allocation failed")
RCUTILS_LOG_ERROR_NAMED(ROS_PACKAGE_NAME, "allocation failed");
exit(RCL_RET_BAD_ALLOC);
}
}
Expand All @@ -104,7 +104,7 @@ INITIALIZER(initialize) {
"Values of RMW_IMPLEMENTATION ('%s') and RCL_ASSERT_RMW_ID_MATCHES ('%s') environment "
"variables do not match, exiting with %d.",
expected_rmw_impl, asserted_rmw_impl, RCL_RET_ERROR
)
);
exit(RCL_RET_ERROR);
}

Expand Down Expand Up @@ -132,7 +132,7 @@ INITIALIZER(initialize) {
"(expected identifier of '%s'), exiting with %d.",
expected_rmw_impl,
RCL_RET_ERROR
)
);
exit(RCL_RET_ERROR);
}
if (strcmp(actual_rmw_impl_id, expected_rmw_impl) != 0) {
Expand All @@ -142,7 +142,7 @@ INITIALIZER(initialize) {
expected_rmw_impl,
actual_rmw_impl_id,
RCL_RET_MISMATCHED_RMW_ID
)
);
exit(RCL_RET_MISMATCHED_RMW_ID);
}
// Free the memory now that all checking has passed.
Expand Down
20 changes: 10 additions & 10 deletions rcl/src/rcl/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ rcl_service_init(
RCL_CHECK_ARGUMENT_FOR_NULL(type_support, RCL_RET_INVALID_ARGUMENT, *allocator);
RCL_CHECK_ARGUMENT_FOR_NULL(service_name, RCL_RET_INVALID_ARGUMENT, *allocator);
RCUTILS_LOG_DEBUG_NAMED(
ROS_PACKAGE_NAME, "Initializing service for service name '%s'", service_name)
ROS_PACKAGE_NAME, "Initializing service for service name '%s'", service_name);
if (service->impl) {
RCL_SET_ERROR_MSG("service already initialized, or memory was unintialized", *allocator);
return RCL_RET_ALREADY_INIT;
Expand All @@ -90,7 +90,7 @@ rcl_service_init(
ROS_PACKAGE_NAME,
"failed to fini string_map (%d) during error handling: %s",
rcutils_ret,
rcutils_get_error_string_safe())
rcutils_get_error_string_safe());
}
if (ret == RCL_RET_BAD_ALLOC) {
return ret;
Expand Down Expand Up @@ -121,7 +121,7 @@ rcl_service_init(
}
goto cleanup;
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Expanded service name '%s'", expanded_service_name)
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Expanded service name '%s'", expanded_service_name);

const rcl_node_options_t * node_options = rcl_node_get_options(node);
if (NULL == node_options) {
Expand Down Expand Up @@ -165,7 +165,7 @@ rcl_service_init(
RCUTILS_LOG_WARN_NAMED(
ROS_PACKAGE_NAME,
"Warning: Setting QoS durability to 'transient local' for service servers "
"can cause them to receive requests from clients that have since terminated.")
"can cause them to receive requests from clients that have since terminated.");
}
// Fill out implementation struct.
// rmw handle (create rmw service)
Expand All @@ -181,7 +181,7 @@ rcl_service_init(
}
// options
service->impl->options = *options;
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service initialized")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service initialized");
ret = RCL_RET_OK;
goto cleanup;
fail:
Expand All @@ -203,7 +203,7 @@ rcl_service_init(
rcl_ret_t
rcl_service_fini(rcl_service_t * service, rcl_node_t * node)
{
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing service")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing service");
rcl_ret_t result = RCL_RET_OK;
RCL_CHECK_ARGUMENT_FOR_NULL(service, RCL_RET_INVALID_ARGUMENT, rcl_get_default_allocator());
RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT, rcl_get_default_allocator());
Expand All @@ -223,7 +223,7 @@ rcl_service_fini(rcl_service_t * service, rcl_node_t * node)
}
allocator.deallocate(service->impl, allocator.state);
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service finalized")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service finalized");
return result;
}

Expand Down Expand Up @@ -276,7 +276,7 @@ rcl_take_request(
rmw_request_id_t * request_header,
void * ros_request)
{
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service server taking service request")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service server taking service request");
const rcl_service_options_t * options = rcl_service_get_options(service);
RCL_CHECK_FOR_NULL_WITH_MSG(
options, "Failed to get service options", return RCL_RET_ERROR, rcl_get_default_allocator());
Expand All @@ -291,7 +291,7 @@ rcl_take_request(
return RCL_RET_ERROR;
}
RCUTILS_LOG_DEBUG_NAMED(
ROS_PACKAGE_NAME, "Service take request succeeded: %s", taken ? "true" : "false")
ROS_PACKAGE_NAME, "Service take request succeeded: %s", taken ? "true" : "false");
if (!taken) {
return RCL_RET_SERVICE_TAKE_FAILED;
}
Expand All @@ -304,7 +304,7 @@ rcl_send_response(
rmw_request_id_t * request_header,
void * ros_response)
{
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Sending service response")
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Sending service response");
const rcl_service_options_t * options = rcl_service_get_options(service);
RCL_CHECK_FOR_NULL_WITH_MSG(
options, "Failed to get service options", return RCL_RET_ERROR, rcl_get_default_allocator());
Expand Down
Loading