aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-08-31 14:17:56 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2012-08-31 14:17:56 -0400
commit58a031f920c225b20fdb45c1e56fe41ed7568900 (patch)
treed2b50c39dfea2c01540702cf5953df0346588926 /src
parentfe811ae8105a89ea60561dfae2fa7c3504a238a1 (diff)
downloadpostgresql-58a031f920c225b20fdb45c1e56fe41ed7568900.tar.gz
postgresql-58a031f920c225b20fdb45c1e56fe41ed7568900.zip
Make configure probe for mbstowcs_l as well as wcstombs_l.
We previously supposed that any given platform would supply both or neither of these functions, so that one configure test would be sufficient. It now appears that at least on AIX this is not the case ... which is likely an AIX bug, but nonetheless we need to cope with it. So use separate tests. Per bug #6758; thanks to Andrew Hastie for doing the followup testing needed to confirm what was happening. Backpatch to 9.1, where we began using these functions.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/adt/pg_locale.c6
-rw-r--r--src/include/pg_config.h.in3
-rw-r--r--src/include/pg_config.h.win323
3 files changed, 9 insertions, 3 deletions
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 92ea4413cc3..297edd63e8a 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -1206,17 +1206,17 @@ char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen,
else
{
#ifdef HAVE_LOCALE_T
-#ifdef HAVE_WCSTOMBS_L
+#ifdef HAVE_MBSTOWCS_L
/* Use mbstowcs_l for nondefault locales */
result = mbstowcs_l(to, str, tolen, locale);
-#else /* !HAVE_WCSTOMBS_L */
+#else /* !HAVE_MBSTOWCS_L */
/* We have to temporarily set the locale as current ... ugh */
locale_t save_locale = uselocale(locale);
result = mbstowcs(to, str, tolen);
uselocale(save_locale);
-#endif /* HAVE_WCSTOMBS_L */
+#endif /* HAVE_MBSTOWCS_L */
#else /* !HAVE_LOCALE_T */
/* Can't have locale != 0 without HAVE_LOCALE_T */
elog(ERROR, "mbstowcs_l is not available");
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index dbe28931f8a..1ffb032835f 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -333,6 +333,9 @@
/* Define to 1 if `long long int' works and is 64 bits. */
#undef HAVE_LONG_LONG_INT_64
+/* Define to 1 if you have the `mbstowcs_l' function. */
+#undef HAVE_MBSTOWCS_L
+
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index e6fc482534b..b7b7c641d3a 100644
--- a/src/include/pg_config.h.win32
+++ b/src/include/pg_config.h.win32
@@ -249,6 +249,9 @@
#define HAVE_LONG_LONG_INT_64
#endif
+/* Define to 1 if you have the `mbstowcs_l' function. */
+#define HAVE_MBSTOWCS_L 1
+
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1