Skip to content

Commit 9688f34

Browse files
committed
Issue json-c#246: Include xlocale.h too, to get locale_t defined, since not all OSes include that in locale.h
1 parent fa76e4a commit 9688f34

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ AC_PROG_CC_C99
3434
AC_CONFIG_HEADER(config.h)
3535
AC_CONFIG_HEADER(json_config.h)
3636
AC_HEADER_STDC
37-
AC_CHECK_HEADERS(fcntl.h limits.h strings.h syslog.h unistd.h [sys/cdefs.h] [sys/param.h] stdarg.h locale.h endian.h)
37+
AC_CHECK_HEADERS(fcntl.h limits.h strings.h syslog.h unistd.h [sys/cdefs.h] [sys/param.h] stdarg.h locale.h xlocale.h endian.h)
3838
AC_CHECK_HEADER(inttypes.h,[AC_DEFINE([JSON_C_HAVE_INTTYPES_H],[1],[Public define for json_inttypes.h])])
3939

4040
# Checks for typedefs, structures, and compiler characteristics.

json_tokener.c

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#ifdef HAVE_LOCALE_H
3636
#include <locale.h>
3737
#endif /* HAVE_LOCALE_H */
38+
#ifdef HAVE_XLOCALE_H
39+
#include <xlocale.h>
40+
#endif
3841

3942
#define jt_hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
4043

tests/test_locale.c

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#ifdef HAVE_LOCALE_H
1212
#include <locale.h>
1313
#endif /* HAVE_LOCALE_H */
14+
#ifdef HAVE_XLOCALE_H
15+
#include <xlocale.h>
16+
#endif
1417

1518
int main(int argc, char **argv)
1619
{

0 commit comments

Comments
 (0)