[PATCH 4/4 v4] xf86Helper: use LogHdrMessageVerb in xf86VDrvMsgVerb

Daniel Kurtz djkurtz at chromium.org
Fri Aug 5 08:01:56 PDT 2011


Hi!

On Fri, Aug 5, 2011 at 10:35 PM, walter harms <wharms at bfs.de> wrote:
>
>
> Am 05.08.2011 16:20, schrieb Daniel Kurtz:
> > 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, 6 insertions(+), 19 deletions(-)
> >
> > diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
> > index f42d0f9..a64b271 100644
> > --- a/hw/xfree86/common/xf86Helper.c
> > +++ b/hw/xfree86/common/xf86Helper.c
> > @@ -1027,36 +1027,23 @@ 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;
> > +    const char *scrnName = NULL;
> >
> >      /* 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);
> > +     scrnName = xf86Screens[scrnIndex]->name;
>
>
> why do you need "scrnName" ?

Good catch.  Vestige of an early implementation.  It'll be gone in the
next version.

-Dan


More information about the xorg-devel mailing list