[PATCH libinput] Add a log_msg_va function
Hans de Goede
hdegoede at redhat.com
Tue Jun 10 06:02:57 PDT 2014
This is useful for when we use libraries which want us to provide them with
a logging callback.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
src/libinput-private.h | 3 +++
src/libinput.c | 16 +++++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/libinput-private.h b/src/libinput-private.h
index ed8190d..a5f1405 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -97,6 +97,9 @@ typedef void (*libinput_source_dispatch_t)(void *data);
void
log_msg(enum libinput_log_priority priority, const char *format, ...);
+void
+log_msg_va(enum libinput_log_priority priority, const char *format,
+ va_list args);
int
libinput_init(struct libinput *libinput,
diff --git a/src/libinput.c b/src/libinput.c
index 5c66159..a6d7af8 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -111,15 +111,21 @@ static struct log_data log_data = {
};
void
+log_msg_va(enum libinput_log_priority priority, const char *format,
+ va_list args)
+{
+ if (log_data.handler && log_data.priority <= priority)
+ log_data.handler(priority, log_data.user_data, format, args);
+}
+
+void
log_msg(enum libinput_log_priority priority, const char *format, ...)
{
va_list args;
- if (log_data.handler && log_data.priority <= priority) {
- va_start(args, format);
- log_data.handler(priority, log_data.user_data, format, args);
- va_end(args);
- }
+ va_start(args, format);
+ log_msg_va(priority, format, args);
+ va_end(args);
}
LIBINPUT_EXPORT void
--
2.0.0
More information about the wayland-devel
mailing list