From a64101800c79c852cc4ab9d445c35aad0a6457eb Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Wed, 27 Feb 2013 00:41:14 +0100 Subject: [PATCH] log.c: Use one printf() instead of two in log_message(). --- src/log.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/log.c b/src/log.c index 5d05e4a..e00a08d 100644 --- a/src/log.c +++ b/src/log.c @@ -41,14 +41,22 @@ void log_message(int level, const char *file, int line, const char *format, ...) default: level_string = "UNKNOWN"; } - va_start(ap, format); -#ifdef DEBUG - fprintf(stdout, "%-12s:%-3d ", file, line); -#else +#ifndef DEBUG + /* Prevent warnings. */ (void)file; (void)line; #endif - fprintf(stdout, "[%s] [%d] ", level_string, (int)pthread_self()); + + va_start(ap, format); + fprintf(stdout, +#ifdef DEBUG + "%-12s:%-3d " +#endif + "[%s] [%d] ", +#ifdef DEBUG + file, line, +#endif + level_string, (int)pthread_self()); vfprintf(stdout, format, ap); fprintf(stdout, "\n"); va_end(ap); -- 2.44.1