From c932fbebdc481ac7cb1a98f5c4410df83a75ec1a Mon Sep 17 00:00:00 2001 From: Siddharth Chandrasekaran Date: Wed, 25 Oct 2023 00:30:08 +0200 Subject: [PATCH] libosdp: Demote osdp_logger_init to a macro alias Since the change is a simple arg addition, we don't really need a proper deprecation workflow. We could just get away by providing a macro alias for the old function signature. Signed-off-by: Siddharth Chandrasekaran --- include/osdp.h | 17 +++++------------ src/osdp_common.c | 6 ------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/include/osdp.h b/include/osdp.h index 8040e003..37b2158c 100644 --- a/include/osdp.h +++ b/include/osdp.h @@ -994,19 +994,12 @@ void osdp_logger_init3(const char *name, int log_level, osdp_log_puts_fn_t puts_fn); /** - * @brief Configure OSDP Logging (deprecated). Provided for backward - * compatiblity. Use osdp_logger_init3 instead. - * - * @param log_level OSDP log levels of type `enum osdp_log_level_e`. Default is - * LOG_INFO. - * @param puts_fn A puts() like function that will be invoked to write the log - * buffer. Can be handy if you want to log to file on a UART - * device without putchar redirection. See `osdp_log_puts_fn_t` - * definition to see the behavioral expectations. When this is - * set to NULL, LibOSDP will log to stderr. + * @brief This macro alias Provided for API compatiblity for existing users who + * using the old osdp_logger_init() API. For description of parameters and use, + * see osdp_logger_init3 documentation. */ -void osdp_logger_init(int log_level, osdp_log_puts_fn_t puts_fn) - __attribute__((deprecated("Use osdp_logger_init3 instead!"))); +#define osdp_logger_init(log_level, log_fn) \ + osdp_logger_init3("osdp", log_level, log_fn) /** * @brief A callback function that gets called when LibOSDP wants to emit a log diff --git a/src/osdp_common.c b/src/osdp_common.c index 247d1a4b..251bb56d 100644 --- a/src/osdp_common.c +++ b/src/osdp_common.c @@ -209,12 +209,6 @@ void osdp_logger_init3(const char *name, int log_level, logger_set_default(&ctx); /* Mark this config as logging default */ } -OSDP_EXPORT -void osdp_logger_init(int log_level, osdp_log_puts_fn_t log_fn) -{ - osdp_logger_init3("osdp", log_level, log_fn); -} - OSDP_EXPORT void osdp_set_log_callback(osdp_log_callback_fn_t cb) {