[PATCH 10/10] xfree86: factor out adding/removing a device from the input device array

Peter Hutterer peter.hutterer at who-t.net
Mon Jul 25 22:49:31 PDT 2011


On Mon, Jul 25, 2011 at 09:15:36AM +0100, Daniel Stone wrote:
> On Mon, Jul 04, 2011 at 04:09:16PM +1000, Peter Hutterer wrote:
> > +/**
> > + * Append pInfo to the null-terminated list, allocating space as necessary.
> > + * pInfo is copied into the last element.
> > + */
> > +static InputInfoPtr*
> > +addDevice(InputInfoPtr *list, InputInfoPtr pInfo)
> > +{
> > +    InputInfoPtr *devs;
> > +    int count = 1;
> > +
> > +    for (devs = list; devs && *devs; devs++)
> > +	count++;
> > +
> > +    list = xnfrealloc(list, (count + 1) * sizeof(InputInfoPtr));
> > +    list[count] = NULL;
> > +
> > +    list[count - 1] = xnfalloc(sizeof(InputInfoRec));
> > +    *list[count - 1] = *pInfo;
> 
> Could you not use your new InputInfoRec duplication here?

I'm planning to use NIDR here eventually, but that requires more time than I
currently have. This patch (and others) will sit in my tree for a while,
except for the three that actually do crash the server.

> 
> > +    return list;
> > +}
> 
> With that, for the series:
> Reviewed-by: Daniel Stone <daniel at fooishbar.org>

thanks.

Cheers,
  Peter


More information about the xorg-devel mailing list