Don't assume that LC_MESSAGES is always available on WIN32. Per Magnus.

This commit is contained in:
Tom Lane 2006-01-02 20:25:45 +00:00
parent 499f4d5e1e
commit fd924b2988
1 changed files with 6 additions and 4 deletions

View File

@ -4,7 +4,7 @@
* *
* Portions Copyright (c) 2002-2005, PostgreSQL Global Development Group * Portions Copyright (c) 2002-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.33 2005/12/28 23:22:51 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.34 2006/01/02 20:25:45 tgl Exp $
* *
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
@ -106,15 +106,17 @@ pg_perm_setlocale(int category, const char *locale)
* We must ignore attempts to set to "", which means "keep using the * We must ignore attempts to set to "", which means "keep using the
* old environment value". * old environment value".
*/ */
if (category != LC_MESSAGES) #ifdef LC_MESSAGES
result = setlocale(category, locale); if (category == LC_MESSAGES)
else
{ {
result = (char *) locale; result = (char *) locale;
if (locale == NULL || locale[0] == '\0') if (locale == NULL || locale[0] == '\0')
return result; return result;
} }
else
#endif #endif
result = setlocale(category, locale);
#endif /* WIN32 */
if (result == NULL) if (result == NULL)
return result; /* fall out immediately on failure */ return result; /* fall out immediately on failure */