You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2007/10/01 16:51:02 UTC
svn commit: r580979 - in /incubator/stdcxx/trunk/src: punct.cpp setlocale.cpp
Author: faridz
Date: Mon Oct 1 07:51:01 2007
New Revision: 580979
URL: http://svn.apache.org/viewvc?rev=580979&view=rev
Log:
2007-10-01 Farid Zaripov <fa...@epam.com>
* Merged the head of branches/4.2.0
Modified:
incubator/stdcxx/trunk/src/punct.cpp
incubator/stdcxx/trunk/src/setlocale.cpp
Modified: incubator/stdcxx/trunk/src/punct.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/src/punct.cpp?rev=580979&r1=580978&r2=580979&view=diff
==============================================================================
--- incubator/stdcxx/trunk/src/punct.cpp (original)
+++ incubator/stdcxx/trunk/src/punct.cpp Mon Oct 1 07:51:01 2007
@@ -132,6 +132,14 @@
// set all categories -- need LC_NUMERIC and LC_CTYPE
const __rw_setlocale clocale (locname, _RWSTD_LC_ALL);
+ if (pfacet->_C_data ()) {
+ // check to see if another thread may have set _C_data()
+ // while we were waiting for the lock in __rw_setlocale
+ // ctor above and, if so, call self recursively on the
+ // already initialized `impdata'
+ return __rw_get_numpunct (pfacet, flags);
+ }
+
// get the lconv data
const lconv* const pconv = localeconv ();
if (!pconv)
@@ -307,6 +315,14 @@
// set all categories -- need LC_NUMERIC and LC_CTYPE
const __rw_setlocale clocale (locname, _RWSTD_LC_ALL);
+
+ if (pfacet->_C_data ()) {
+ // check to see if another thread may have set _C_data()
+ // while we were waiting for the lock in __rw_setlocale
+ // ctor above and, if so, call self recursively on the
+ // already initialized `impdata'
+ return __rw_get_moneypunct (pfacet, flags);
+ }
// get the lconv data
const lconv* const pconv = localeconv ();
Modified: incubator/stdcxx/trunk/src/setlocale.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/src/setlocale.cpp?rev=580979&r1=580978&r2=580979&view=diff
==============================================================================
--- incubator/stdcxx/trunk/src/setlocale.cpp (original)
+++ incubator/stdcxx/trunk/src/setlocale.cpp Mon Oct 1 07:51:01 2007
@@ -135,18 +135,18 @@
// was in effect when the object was constructed
__rw_setlocale::~__rw_setlocale ()
{
- // release the lock
- if (_C_guard)
- __rw_setlocale_mutex._C_release ();
-
- if (_C_name) {
+ // if guard is set, constructor changed the locale
+ if (_C_guard) {
- // and restore the locale
+ // restore the locale
::setlocale (_C_cat, _C_name);
- if (_C_name != _C_namebuf)
- delete [] _C_name;
+ // release the lock
+ __rw_setlocale_mutex._C_release ();
}
+
+ if (_C_name != _C_namebuf)
+ delete [] _C_name;
}