From 1eedbd1bd2037437f5b9aed1f4061af396ef6733 Mon Sep 17 00:00:00 2001 From: Nikolai Kondrashov Date: Fri, 10 Jan 2014 13:00:42 +0200 Subject: Cleanup debug_fn Cleanup debug_fn to better match coding conventions. Reviewed-by: Jakub Hrozek Reviewed-by: Stephen Gallagher Reviewed-by: Simo Sorce --- src/util/debug.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/util') diff --git a/src/util/debug.c b/src/util/debug.c index a42623f1a..4c49dc662 100644 --- a/src/util/debug.c +++ b/src/util/debug.c @@ -131,11 +131,12 @@ static void debug_printf(const char *format, ...) void debug_fn(const char *function, int newlevel, const char *format, ...) { va_list ap; + struct timeval tv; + struct tm *tm; + char datetime[20]; + int year; + if (debug_timestamps) { - struct timeval tv; - struct tm *tm; - char datetime[20]; - int year; gettimeofday(&tv, NULL); tm = localtime(&tv.tv_sec); year = tm->tm_year + 1900; @@ -156,6 +157,7 @@ void debug_fn(const char *function, int newlevel, const char *format, ...) debug_printf("[%s] [%s] (%#.4x): ", debug_prg_name, function, newlevel); } + va_start(ap, format); debug_vprintf(format, ap); va_end(ap); -- cgit