Commit 3d9ff270 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Pavel Emelyanov

print_on_level(): simplify off setting code

This is a slight refactoring of commit 7de96526, 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 <gorcunov@openvz.org>
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 81ee51f0
...@@ -138,17 +138,16 @@ unsigned int log_get_loglevel(void) ...@@ -138,17 +138,16 @@ unsigned int log_get_loglevel(void)
static void __print_on_level(unsigned int loglevel, const char *format, va_list params) 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)) { if (unlikely(loglevel == LOG_MSG)) {
fd = STDOUT_FILENO; fd = STDOUT_FILENO;
off = buf_off; off = buf_off; /* skip dangling timestamp */
} else { } else {
if (loglevel > current_loglevel) if (loglevel > current_loglevel)
return; return;
fd = log_get_fd(); fd = log_get_fd();
print_ts(); print_ts();
off = 0;
} }
size = vsnprintf(buffer + buf_off, PAGE_SIZE - buf_off, format, params); size = vsnprintf(buffer + buf_off, PAGE_SIZE - buf_off, format, params);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment