diff options
author | Daniel Kurtz <djkurtz@chromium.org> | 2011-08-08 15:09:48 +0800 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-08-22 15:56:44 +1000 |
commit | 033f53c223dc12a91f00e10a69f87a4f2a7adb6b (patch) | |
tree | c4d445fe1791beb36021b0f32f1733f4e45c241c | |
parent | cd8ee3e5cb29b9cd6402d2fbc71463c6b04b6077 (diff) |
xf86Helper: use LogHdrMessageVerb in xf86VDrvMsgVerb
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@chromium.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | hw/xfree86/common/xf86Helper.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index f42d0f9df..d6c2a7b81 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1027,36 +1027,20 @@ xf86EnableDisableFBAccess(int scrnIndex, Bool enable) } } -/* Print driver messages in the standard format */ - -#undef PREFIX_SIZE -#define PREFIX_SIZE 14 - +/* Print driver messages in the standard format of + (<type>) <screen name>(<screen index>): <message> */ void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, va_list args) { - char *tmpFormat; - /* Prefix the scrnIndex name to the format string. */ if (scrnIndex >= 0 && scrnIndex < xf86NumScreens && - xf86Screens[scrnIndex]->name) { - tmpFormat = malloc(strlen(format) + - strlen(xf86Screens[scrnIndex]->name) + - PREFIX_SIZE + 1); - if (!tmpFormat) - return; - - snprintf(tmpFormat, PREFIX_SIZE + 1, "%s(%d): ", - xf86Screens[scrnIndex]->name, scrnIndex); - - strcat(tmpFormat, format); - LogVMessageVerb(type, verb, tmpFormat, args); - free(tmpFormat); - } else + xf86Screens[scrnIndex]->name) + LogHdrMessageVerb(type, verb, format, args, "%s(%d): ", + xf86Screens[scrnIndex]->name, scrnIndex); + else LogVMessageVerb(type, verb, format, args); } -#undef PREFIX_SIZE /* Print driver messages, with verbose level specified directly */ void |