From 83b5721607c069bf19cb6ce14cdd1e4f08c0a033 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Wed, 29 Jun 2005 15:36:40 +0000 Subject: [PATCH] Move the log_level_name[] definitions back to private status within the library. Defining static data in the header causes warnings on Apple gcc, and in general this should be the client's responsibility. The names are obvious from the log_level enum, which is public, and it's only one line of boilerplate to copy in implementing a custom logging function. --- examples/basic_logging.c | 4 +++- src/ctx.c | 2 ++ strophe.h | 2 -- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/basic_logging.c b/examples/basic_logging.c index bd02950..0ad27a1 100644 --- a/examples/basic_logging.c +++ b/examples/basic_logging.c @@ -21,7 +21,9 @@ void log_handler(void * const userdata, const char * const area, const char * const msg) { - fprintf(stderr, "%s %s %s\n", area, xmpp_log_level_name[level], msg); + static const char * const log_level_name[4] = {"DEBUG", "INFO", "WARN", "ERROR"}; + + fprintf(stderr, "%s %s %s\n", area, log_level_name[level], msg); } void conn_handler(xmpp_conn_t * const conn, const xmpp_conn_event_t status, diff --git a/src/ctx.c b/src/ctx.c index e98da55..4c05cb4 100644 --- a/src/ctx.c +++ b/src/ctx.c @@ -63,6 +63,8 @@ static xmpp_mem_t xmpp_default_mem = { realloc }; +static const char * const xmpp_log_level_name[4] = {"DEBUG", "INFO", "WARN", "ERROR"}; + void xmpp_default_logger(void * const userdata, const xmpp_log_level_t level, const char * const area, diff --git a/strophe.h b/strophe.h index 9b04ec5..f690b17 100644 --- a/strophe.h +++ b/strophe.h @@ -63,8 +63,6 @@ typedef enum { XMPP_LEVEL_ERROR } xmpp_log_level_t; -static const char * const xmpp_log_level_name[4] = {"DEBUG", "INFO", "WARN", "ERROR"}; - typedef enum { XMPP_UNKNOWN, XMPP_CLIENT,