From 64aba297a2f62e63ad433f9302a82fafeafb993f Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Wed, 15 Jun 2005 18:15:08 +0000 Subject: [PATCH] Fix bug with NULL log handlers. Also, default log handler is NULL always. --- src/ctx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ctx.c b/src/ctx.c index 202b0e5..4c05cb4 100644 --- a/src/ctx.c +++ b/src/ctx.c @@ -73,12 +73,7 @@ void xmpp_default_logger(void * const userdata, fprintf(stderr, "%s %s %s\n", area, xmpp_log_level_name[level], msg); } -#ifdef _WIN32 static xmpp_log_t xmpp_default_log = { NULL, NULL }; -#else -static xmpp_log_t xmpp_default_log = { xmpp_default_logger, NULL }; -#endif - /** convenience functions for accessing the context **/ @@ -114,7 +109,8 @@ void xmpp_log(const xmpp_ctx_t * const ctx, vsnprintf(buf, 1023, fmt, ap); - ctx->log->handler(ctx->log->userdata, level, area, buf); + if (ctx->log->handler) + ctx->log->handler(ctx->log->userdata, level, area, buf); } void xmpp_error(const xmpp_ctx_t * const ctx,