use RCUTILS_SAFE_FWRITE_TO_STDERR (#184)

* use RCUTILS_SAFE_FWRITE_TO_STDERR

* include-what-you-use and not rely on rcl/error_handling to provide this macro
This commit is contained in:
Mikael Arguedas 2017-11-16 18:17:45 -08:00 committed by GitHub
parent c4bc5aceb9
commit b40eff9b9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"
@ -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}"
@ -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)