Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8539a0e

Browse files
committed
Check for C/POSIX before assuming that nl_langinfo or win32_langinfo
will work. Per buildfarm results.
1 parent8f8a5df commit8539a0e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

‎src/port/chklocale.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/chklocale.c,v 1.12 2009/11/1202:46:16 tgl Exp $
11+
* $PostgreSQL: pgsql/src/port/chklocale.c,v 1.13 2009/11/1203:37:15 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -237,6 +237,11 @@ pg_get_encoding_from_locale(const char *ctype)
237237
char*save;
238238
char*name;
239239

240+
/* If locale is C or POSIX, we can allow all encodings */
241+
if (pg_strcasecmp(ctype,"C")==0||
242+
pg_strcasecmp(ctype,"POSIX")==0)
243+
returnPG_SQL_ASCII;
244+
240245
save=setlocale(LC_CTYPE,NULL);
241246
if (!save)
242247
return-1;/* setlocale() broken? */
@@ -269,6 +274,12 @@ pg_get_encoding_from_locale(const char *ctype)
269274
ctype=setlocale(LC_CTYPE,NULL);
270275
if (!ctype)
271276
return-1;/* setlocale() broken? */
277+
278+
/* If locale is C or POSIX, we can allow all encodings */
279+
if (pg_strcasecmp(ctype,"C")==0||
280+
pg_strcasecmp(ctype,"POSIX")==0)
281+
returnPG_SQL_ASCII;
282+
272283
#ifndefWIN32
273284
sys=nl_langinfo(CODESET);
274285
if (sys)
@@ -281,13 +292,6 @@ pg_get_encoding_from_locale(const char *ctype)
281292
if (!sys)
282293
return-1;/* out of memory; unlikely */
283294

284-
/* If locale is C or POSIX, we can allow all encodings */
285-
if (pg_strcasecmp(ctype,"C")==0||pg_strcasecmp(ctype,"POSIX")==0)
286-
{
287-
free(sys);
288-
returnPG_SQL_ASCII;
289-
}
290-
291295
/* Check the table */
292296
for (i=0;encoding_match_list[i].system_enc_name;i++)
293297
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp