[PATCH 3/4 v4] xf86Helper: use LogHdrMessageVerb in xf86VIDrvMsgVerb
Daniel Kurtz
djkurtz at chromium.org
Fri Aug 5 07:20:12 PDT 2011
LogHdrMessageVerb allows passing a parameterized header to insert in a log
message between MessageType and the formatted message body string.
Signed-off-by: Daniel Kurtz <djkurtz at chromium.org>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
hw/xfree86/common/xf86Helper.c | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index f8e6c8b..f42d0f9 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1082,20 +1082,23 @@ xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
}
/* Print input driver messages in the standard format of
- <driver>: <device name>: <message> */
+ (<type>) <driver>: <device name>: <message> */
void
-xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
- va_list args)
+xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb,
+ const char *format, va_list args)
{
- char *msg;
+ const char *driverName = NULL;
+ const char *deviceName = NULL;
- if (asprintf(&msg, "%s: %s: %s", dev->drv->driverName, dev->name, format)
- == -1) {
- LogVMessageVerb(type, verb, "%s", args);
- } else {
- LogVMessageVerb(type, verb, msg, args);
- free(msg);
+ /* Prefix driver and device names to formatted message. */
+ if (dev) {
+ deviceName = dev->name;
+ if (dev->drv)
+ driverName = dev->drv->driverName;
}
+
+ LogHdrMessageVerb(type, verb, format, args, "%s: %s: ", driverName,
+ deviceName);
}
/* Print input driver message, with verbose level specified directly */
--
1.7.3.1
More information about the xorg-devel
mailing list