From 3c82771d65f65f2cc5f4bfd4791014da07620518 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Thu, 21 Mar 2024 11:26:59 +0100 Subject: Make the lib c++ friendly --- any_log.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'any_log.h') diff --git a/any_log.h b/any_log.h index dcfbfcc..167aaa3 100644 --- a/any_log.h +++ b/any_log.h @@ -192,6 +192,10 @@ typedef enum { #define ANY_LOG_ATTRIBUTE(...) #endif +#ifdef __cpluscplus +extern "C" { +#endif + // All log functions will ignore the message if the level is below the // threshold specified in any_log_level. // @@ -234,6 +238,10 @@ ANY_LOG_ATTRIBUTE(nonnull(1, 4)) void any_log_panic(const char *file, int line, const char *module, const char *func, const char *format, ...); +#ifdef __cpluscplus +} +#endif + #endif #ifdef ANY_LOG_IMPLEMENT @@ -287,9 +295,9 @@ const char *any_log_level_to_string(any_log_level_t level) any_log_level_t any_log_level_from_string(const char *string) { - for (any_log_level_t level = ANY_LOG_PANIC; level < ANY_LOG_ALL; level++) { + for (int level = ANY_LOG_PANIC; level < ANY_LOG_ALL; level++) { if (strcmp(any_log_level_strings[level], string) == 0) - return level; + return (any_log_level_t)level; } return ANY_LOG_ALL; -- cgit v1.2.3