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

Patrik Jakobsson patrik.r.jakobsson at gmail.com
Sun Jan 5 09:32:56 PST 2014


On Sun, Jan 5, 2014 at 11:55 AM, Julien Cristau <jcristau at debian.org> wrote:
> On Sat, Jan  4, 2014 at 20:35:06 +0100, Patrik Jakobsson wrote:
>
>> asprintf needs _GNU_SOURCE to be defined or you'll get an implicit declaration
>> and build failure. I fixed it with:
>>
>> diff --git a/src/mouse.c b/src/mouse.c
>> index 2da2b4d..6678d24 100644
>> --- a/src/mouse.c
>> +++ b/src/mouse.c
>> @@ -47,6 +47,10 @@
>>  #include "config.h"
>>  #endif
>>
>> +#if defined(HAVE_ASPRINTF)
>> +# define _GNU_SOURCE
>> +#endif
>> +
>>  #include <xorg-server.h>
>>  #include <math.h>
>>  #include <string.h>
>>
> The usual fix for this is to add AC_USE_SYSTEM_EXTENSIONS to
> configure.ac, which should do the right thing.
>
> Cheers,
> Julien

Thanks, that works as well. I'll send a patch for this so it's not forgotten.

-Patrik


More information about the xorg-devel mailing list