[PATCH:xf86-input-mouse] Use asprintf (or Xprintf on old servers) instead of strdup+sprintf

Alan Coopersmith alan.coopersmith at oracle.com
Thu Oct 24 07:56:01 CEST 2013


On 10/21/13 03:02 PM, Peter Hutterer wrote:
> On Sat, Oct 19, 2013 at 09:51:31PM -0700, Alan Coopersmith wrote:
>>
>> +/* Xorg >= 1.10 provides an asprintf() implementation even if libc doesn't */
>> +#include "xorgVersion.h"
>> +#if defined(HAVE_ASPRINTF) || \
>> +    (XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,9,99,901,0))
>
> use 1.10.0 as version here. let's not worry about release candidates here and
> it will make the code easier to read.

Okay - I'd just copied & pasted that from one of the other drivers using the
server provided asprintf.

> if Xprintf is an API that we still support, already uses
> asprintf anyway why not use just that and ditch the #ifdef's?

Because it's marked deprecated so causes warnings.   I don't remember how long
we said we'd keep Xprintf - probably could drop it in one of these ABI breaking
releases, since it's been a couple years now.

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list