[pulseaudio-discuss] [PATCH] netbsd: Improve handling of <locale> and <xlocale.h> headers

David Henningsson david.henningsson at canonical.com
Fri Nov 27 01:07:56 PST 2015



On 2015-11-21 00:38, Kamil Rytarowski wrote:
> NetBSD ships with strtod_l(3) in <stdlib.h>.
> Having strtol_l(3) isn't relevant to having <xlocale.h>.
> Generalize inclusion of <locale.h> and <xlocale.h>.

Hmm, but we don't need to include either if we don't have strtod_l, 
because that's the only function needing anything from locale.h/xlocale.h.

> ---
>   configure.ac              | 1 +
>   src/pulsecore/core-util.c | 6 ++++--
>   2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 003673e..5b3ce7d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -447,6 +447,7 @@ AC_CHECK_HEADERS_ONCE([sys/eventfd.h])
>   AC_CHECK_HEADERS_ONCE([execinfo.h])
>   AC_CHECK_HEADERS_ONCE([langinfo.h])
>   AC_CHECK_HEADERS_ONCE([regex.h pcreposix.h])
> +AC_CHECK_HEADERS_ONCE([locale.h xlocale.h])

...this seems reasonable, but...

>
>   AM_CONDITIONAL(HAVE_SYS_EVENTFD_H, test "x$ac_cv_header_sys_eventfd_h" = "xyes")
>
> diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
> index 2099686..24babcb 100644
> --- a/src/pulsecore/core-util.c
> +++ b/src/pulsecore/core-util.c
> @@ -52,8 +52,11 @@
>   #include <pcreposix.h>
>   #endif
>
> -#ifdef HAVE_STRTOD_L
> +#ifdef HAVE_LOCALE_H
>   #include <locale.h>
> +#endif
> +
> +#ifdef HAVE_XLOCALE_H
>   #include <xlocale.h>
>   #endif

...per the reasoning above, I think it should instead change to:

#ifdef HAVE_STRTOD_L
   #ifdef HAVE_LOCALE_H
     #include <locale.h>
   #endif
   #ifdef HAVE_XLOCALE_H
     #include <xlocale.h>
   #endif
#endif

>
> @@ -106,7 +109,6 @@
>   #endif
>
>   #ifdef __APPLE__
> -#include <xlocale.h>
>   #include <mach/mach_init.h>
>   #include <mach/thread_act.h>
>   #include <mach/thread_policy.h>
>

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list