From 3b9475bb142bc6226b7441e5926eecb3f3dbf9d9 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Fri, 3 May 2019 00:21:46 +0000 Subject: [PATCH 1/3] Add an allocator to the external logging initialization. Signed-off-by: Chris Lalancette --- rcl/include/rcl/logging_external_interface.h | 2 +- rcl/src/rcl/logging.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rcl/include/rcl/logging_external_interface.h b/rcl/include/rcl/logging_external_interface.h index ae682033c..12580ee58 100644 --- a/rcl/include/rcl/logging_external_interface.h +++ b/rcl/include/rcl/logging_external_interface.h @@ -31,7 +31,7 @@ RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t -rcl_logging_external_initialize(const char * config_file); +rcl_logging_external_initialize(const char * config_file, rcutils_allocator_t allocator); /// Free the resources allocated for the external logging system. /** diff --git a/rcl/src/rcl/logging.c b/rcl/src/rcl/logging.c index 3d31e1e7d..ee93fc0a2 100644 --- a/rcl/src/rcl/logging.c +++ b/rcl/src/rcl/logging.c @@ -93,7 +93,7 @@ rcl_logging_configure(const rcl_arguments_t * global_args, const rcl_allocator_t } } if (g_rcl_logging_ext_lib_enabled) { - status = rcl_logging_external_initialize(config_file); + status = rcl_logging_external_initialize(config_file, g_logging_allocator); if (RCL_RET_OK == status) { rcl_logging_external_set_logger_level(NULL, default_level); g_rcl_logging_out_handlers[g_rcl_logging_num_out_handlers++] = From 31640d3f1ab123f2635e556c0147fce0e0d1a7d8 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Fri, 3 May 2019 01:17:16 +0000 Subject: [PATCH 2/3] Add in a TODO comment to deduplicate headers. Signed-off-by: Chris Lalancette --- rcl/include/rcl/logging_external_interface.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rcl/include/rcl/logging_external_interface.h b/rcl/include/rcl/logging_external_interface.h index 12580ee58..1353bcb8f 100644 --- a/rcl/include/rcl/logging_external_interface.h +++ b/rcl/include/rcl/logging_external_interface.h @@ -25,6 +25,12 @@ * logging library should use to configure itself. * If no config file is provided this will be set to an empty string. * Must be a NULL terminated c string. + * \param[in] allocator The allocator to use for memory allocation. + * \todo TODO(clalancette) This API is marked RCL_PUBLIC, but is not built or + * exported from librcl. Instead, these headers should be split into a + * separate package which is then depended on by both rcl and the + * rcl_logging_* implementations. The duplicated headers from the + * implementations could then be removed. * \return RCL_RET_OK if initialized successfully, or * \return RCL_RET_ERROR if an unspecified error occurs. */ From 4229bee648bd9518a32c84641dd0739231292e4c Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Fri, 3 May 2019 01:25:27 +0000 Subject: [PATCH 3/3] More comments. Signed-off-by: Chris Lalancette --- rcl/include/rcl/logging_external_interface.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/rcl/include/rcl/logging_external_interface.h b/rcl/include/rcl/logging_external_interface.h index 1353bcb8f..60e2fed1b 100644 --- a/rcl/include/rcl/logging_external_interface.h +++ b/rcl/include/rcl/logging_external_interface.h @@ -25,12 +25,14 @@ * logging library should use to configure itself. * If no config file is provided this will be set to an empty string. * Must be a NULL terminated c string. - * \param[in] allocator The allocator to use for memory allocation. + * \param[in] allocator The allocator to use for memory allocation. This is + * an rcutils_allocator_t rather than an rcl_allocator_t to ensure that the + * rcl_logging_* packages don't have a circular dependency back to rcl. * \todo TODO(clalancette) This API is marked RCL_PUBLIC, but is not built or - * exported from librcl. Instead, these headers should be split into a - * separate package which is then depended on by both rcl and the - * rcl_logging_* implementations. The duplicated headers from the - * implementations could then be removed. + * exported from librcl. Instead, these headers should be split into a + * separate package which is then depended on by both rcl and the + * rcl_logging_* implementations. The duplicated headers from the + * implementations could then be removed. * \return RCL_RET_OK if initialized successfully, or * \return RCL_RET_ERROR if an unspecified error occurs. */