From 3d9ff2706fa7e1bfac2e1c032c6b5a5b537a92d5 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 8 Jan 2014 19:36:24 -0800 Subject: [PATCH] print_on_level(): simplify off setting code This is a slight refactoring of commit 7de9652, which just simplifies initialization of 'off' variable, and adds the comment why we do so. Should make the next patch easier to read. Cc: Cyrill Gorcunov Signed-off-by: Kir Kolyshkin Acked-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- log.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/log.c b/log.c index 6a9cb0c00..8d8193252 100644 --- a/log.c +++ b/log.c @@ -138,17 +138,16 @@ unsigned int log_get_loglevel(void) static void __print_on_level(unsigned int loglevel, const char *format, va_list params) { - int fd, size, ret, off; + int fd, size, ret, off = 0; if (unlikely(loglevel == LOG_MSG)) { fd = STDOUT_FILENO; - off = buf_off; + off = buf_off; /* skip dangling timestamp */ } else { if (loglevel > current_loglevel) return; fd = log_get_fd(); print_ts(); - off = 0; } size = vsnprintf(buffer + buf_off, PAGE_SIZE - buf_off, format, params);