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:
parent
c4bc5aceb9
commit
b40eff9b9e
1 changed files with 2 additions and 3 deletions
|
@ -26,6 +26,7 @@ extern "C"
|
||||||
#include "rcl/error_handling.h"
|
#include "rcl/error_handling.h"
|
||||||
#include "rcl/types.h"
|
#include "rcl/types.h"
|
||||||
#include "rcl/validate_topic_name.h"
|
#include "rcl/validate_topic_name.h"
|
||||||
|
#include "rcutils/error_handling.h"
|
||||||
#include "rcutils/format_string.h"
|
#include "rcutils/format_string.h"
|
||||||
#include "rcutils/repl_str.h"
|
#include "rcutils/repl_str.h"
|
||||||
#include "rcutils/strdup.h"
|
#include "rcutils/strdup.h"
|
||||||
|
@ -34,8 +35,6 @@ extern "C"
|
||||||
#include "rmw/validate_namespace.h"
|
#include "rmw/validate_namespace.h"
|
||||||
#include "rmw/validate_node_name.h"
|
#include "rmw/validate_node_name.h"
|
||||||
|
|
||||||
#define SAFE_FWRITE_TO_STDERR(msg) fwrite(msg, sizeof(char), sizeof(msg), stderr)
|
|
||||||
|
|
||||||
// built-in substitution strings
|
// built-in substitution strings
|
||||||
#define SUBSTITUION_NODE_NAME "{node}"
|
#define SUBSTITUION_NODE_NAME "{node}"
|
||||||
#define SUBSTITUION_NAMESPACE "{ns}"
|
#define SUBSTITUION_NAMESPACE "{ns}"
|
||||||
|
@ -175,7 +174,7 @@ rcl_expand_topic_name(
|
||||||
"unknown substitution: %s", unmatched_substitution);
|
"unknown substitution: %s", unmatched_substitution);
|
||||||
msg = allocated_msg;
|
msg = allocated_msg;
|
||||||
} else {
|
} 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";
|
msg = "unknown substitution: allocation failed when reporting error";
|
||||||
}
|
}
|
||||||
RCL_SET_ERROR_MSG(msg, allocator)
|
RCL_SET_ERROR_MSG(msg, allocator)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue