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

Commita62d90f

Browse files
committed
Revert "Blind attempt to fix _configthreadlocale() failures on MinGW."
This reverts commit2cf91cc.When using the old msvcrt.dll, MinGW would supply its own dummy versionof _configthreadlocale() that just returns -1 if you try to use it. Fora time we tolerated that to shut the build farm up. We would fall backto code that was enough for the tests to pass, but it would surely haverisked crashing a real multithreaded program.We don't need that kludge anymore, because we can count on ucrt. Weexpect the real _configthreadlocale() to be present, and the ECPG testswill now fail if it isn't. The workaround was dead code and it's timeto revert it.(A later patch still under review proposes to remove this use of_configthreadlocale() completely but we're unwinding this code insteps.)Reviewed-by: Peter Eisentraut <peter@eisentraut.org>Discussion:https://postgr.es/m/d9e7731c-ca1b-477c-9298-fa51e135574a%40eisentraut.org
1 parent1758d42 commita62d90f

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

‎src/interfaces/ecpg/ecpglib/descriptor.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
512512
}
513513
#ifdefWIN32
514514
if (stmt.oldthreadlocale!=-1)
515-
(void)_configthreadlocale(stmt.oldthreadlocale);
515+
_configthreadlocale(stmt.oldthreadlocale);
516516
#endif
517517
#endif
518518
}

‎src/interfaces/ecpg/ecpglib/execute.c‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,9 +1977,7 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator,
19771977
* Make sure we do NOT honor the locale for numeric input/output since the
19781978
* database wants the standard decimal point. If available, use
19791979
* uselocale() for this because it's thread-safe. Windows doesn't have
1980-
* that, but it usually does have _configthreadlocale(). In some versions
1981-
* of MinGW, _configthreadlocale() exists but always returns -1 --- so
1982-
* treat that situation as if the function doesn't exist.
1980+
* that, but it does have _configthreadlocale().
19831981
*/
19841982
#ifdefHAVE_USELOCALE
19851983

@@ -1997,6 +1995,11 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator,
19971995
#else
19981996
#ifdefWIN32
19991997
stmt->oldthreadlocale=_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
1998+
if (stmt->oldthreadlocale==-1)
1999+
{
2000+
ecpg_do_epilogue(stmt);
2001+
return false;
2002+
}
20002003
#endif
20012004
stmt->oldlocale=ecpg_strdup(setlocale(LC_NUMERIC,NULL),lineno);
20022005
if (stmt->oldlocale==NULL)
@@ -2218,17 +2221,12 @@ ecpg_do_epilogue(struct statement *stmt)
22182221
uselocale(stmt->oldlocale);
22192222
#else
22202223
if (stmt->oldlocale)
2224+
{
22212225
setlocale(LC_NUMERIC,stmt->oldlocale);
22222226
#ifdefWIN32
2223-
2224-
/*
2225-
* This is a bit trickier than it looks: if we failed partway through
2226-
* statement initialization, oldthreadlocale could still be 0. But that's
2227-
* okay because a call with 0 is defined to be a no-op.
2228-
*/
2229-
if (stmt->oldthreadlocale!=-1)
2230-
(void)_configthreadlocale(stmt->oldthreadlocale);
2227+
_configthreadlocale(stmt->oldthreadlocale);
22312228
#endif
2229+
}
22322230
#endif
22332231

22342232
free_statement(stmt);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp