]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/commitdiff
log.c: Use one printf() instead of two in log_message().
authorSimon Ruderich <simon@ruderich.org>
Tue, 26 Feb 2013 23:41:14 +0000 (00:41 +0100)
committerSimon Ruderich <simon@ruderich.org>
Tue, 26 Feb 2013 23:41:14 +0000 (00:41 +0100)
src/log.c

index 5d05e4addf461c05f5cdae8302e2037cd2badd17..e00a08d8aa77f9a2914ce39fee3821c97bd87e97 100644 (file)
--- 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);