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

Julien Cristau jcristau at debian.org
Sun Jan 5 02:55:42 PST 2014


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


More information about the xorg-devel mailing list