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

Daniel Stone daniel at fooishbar.org
Mon Jul 25 01:15:36 PDT 2011


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?

> +    return list;
> +}

With that, for the series:
Reviewed-by: Daniel Stone <daniel at fooishbar.org>

Cheers,
Daniel


More information about the xorg-devel mailing list