Skip to content

Commit

Permalink
use RCUTILS_SAFE_FWRITE_TO_STDERR (ros2#184)
Browse files Browse the repository at this point in the history
* use RCUTILS_SAFE_FWRITE_TO_STDERR

* include-what-you-use and not rely on rcl/error_handling to provide this macro
  • Loading branch information
mikaelarguedas authored Nov 17, 2017
1 parent c4bc5ac commit b40eff9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rcl/src/rcl/expand_topic_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern "C"
#include "rcl/error_handling.h"
#include "rcl/types.h"
#include "rcl/validate_topic_name.h"
#include "rcutils/error_handling.h"
#include "rcutils/format_string.h"
#include "rcutils/repl_str.h"
#include "rcutils/strdup.h"
Expand All @@ -34,8 +35,6 @@ extern "C"
#include "rmw/validate_namespace.h"
#include "rmw/validate_node_name.h"

#define SAFE_FWRITE_TO_STDERR(msg) fwrite(msg, sizeof(char), sizeof(msg), stderr)

// built-in substitution strings
#define SUBSTITUION_NODE_NAME "{node}"
#define SUBSTITUION_NAMESPACE "{ns}"
Expand Down Expand Up @@ -175,7 +174,7 @@ rcl_expand_topic_name(
"unknown substitution: %s", unmatched_substitution);
msg = allocated_msg;
} else {
SAFE_FWRITE_TO_STDERR("failed to allocate memory for error message\n");
RCUTILS_SAFE_FWRITE_TO_STDERR("failed to allocate memory for error message\n");
msg = "unknown substitution: allocation failed when reporting error";
}
RCL_SET_ERROR_MSG(msg, allocator)
Expand Down

0 comments on commit b40eff9

Please sign in to comment.