stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r712454 - /stdcxx/branches/4.2.x/src/locale_body.cpp
Date Sun, 09 Nov 2008 00:45:30 GMT
Author: sebor
Date: Sat Nov  8 16:45:30 2008
New Revision: 712454

URL: http://svn.apache.org/viewvc?rev=712454&view=rev
Log:
2008-11-08  Martin Sebor  <sebor@apache.org>

	STDCXX-914
	* src/locale_body (__rw_locale::_C_manage): Optimized the detection
	and "destruction" of the classic C locale.
	(__rw_locale::_C_is_managed): Optimized the detection of the same.

Modified:
    stdcxx/branches/4.2.x/src/locale_body.cpp

Modified: stdcxx/branches/4.2.x/src/locale_body.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/locale_body.cpp?rev=712454&r1=712453&r2=712454&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/locale_body.cpp (original)
+++ stdcxx/branches/4.2.x/src/locale_body.cpp Sat Nov  8 16:45:30 2008
@@ -859,6 +859,21 @@
         return tmp;
     }
 
+    if (plocale && plocale == classic) {
+        // optimize the "destruction" of the classic C locale
+        // the object is never destroyed and its reference count
+        // never drops to 0
+        _RWSTD_ASSERT (__rw_is_C (locname));
+        _RWSTD_ASSERT (__rw_is_C (plocale->_C_name));
+
+        const size_t ref =
+            _RWSTD_ATOMIC_PREDECREMENT (plocale->_C_ref, false);
+
+        _RWSTD_ASSERT (ref + 1U != 0);
+        _RWSTD_UNUSED (ref);
+
+        return 0;
+    }
 
     // re-entrant to protect static local data structures
     // (not the locales themselves)
@@ -1066,6 +1081,15 @@
             return false;
         }
 
+        _RWSTD_ASSERT (0 == _C_usr_facets);
+
+        if (_C_all == _C_std_facet_bits && 0 == _C_byname_facet_bits) {
+            // optimized for the C locale
+            _RWSTD_ASSERT (__rw_is_C (_C_name));
+
+            return true;
+        }
+
         // unless all facets in the same category come either from
         // the C locale or from some named locale the locale object
         // containing the facets is not managed (this test doesn't



Mime
View raw message