From 3279845d634617fa5b19c2392d445f9891fbc67c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 8 Nov 2017 11:32:35 +1000 Subject: [PATCH] evdev: reduce the number of separate calls to log_msg We somewhat expect log message handlers to figure out how to prefix newlines correctly anyway, but reducing the number of messages printed separately makes the simple case better. Signed-off-by: Peter Hutterer --- src/evdev.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/evdev.h b/src/evdev.h index 2c410b24..7d5e6efb 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -655,17 +655,14 @@ evdev_log_msg_va(struct evdev_device *device, const char *format, va_list args) { + /* Anything info and above is user-visible, use the device name */ log_msg(evdev_libinput_context(device), priority, - "%-7s - ", - evdev_device_get_sysname(device)); - - /* Anything info and above is user-visible, use the device name */ - if (priority > LIBINPUT_LOG_PRIORITY_DEBUG) - log_msg(evdev_libinput_context(device), - priority, - "%s: ", - device->devname); + "%-7s - %s%s", + evdev_device_get_sysname(device), + (priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? device->devname : "", + (priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? ": " : "" + ); log_msg_va(evdev_libinput_context(device), priority,