7148352 performance improvement for stdcxx based on 7144618
authorStefan Teleman <stefan.teleman@oracle.com>
Wed, 21 Mar 2012 11:17:19 -0700
changeset 742 8e2984d64f67
parent 741 83cb76377624
child 743 ac51639ccac1
7148352 performance improvement for stdcxx based on 7144618
components/stdcxx/patches/092-7148352-basic_ios.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/stdcxx/patches/092-7148352-basic_ios.patch	Wed Mar 21 11:17:19 2012 -0700
@@ -0,0 +1,26 @@
+# patch for 7148352
+--- stdcxx-4.2.1/include/rw/_basic_ios.h	2008-04-24 17:23:43.000000000 -0700
++++ stdcxx-4.2.1/include/rw/_basic_ios.h	2012-03-08 10:57:28.262697514 -0800
[email protected]@ -217,12 +217,20 @@
+ 
+     // 27.4.4.2, p10
+     char narrow (char_type __c, char __dflt) const {
+-        return _USE_FACET (ctype<char_type>, getloc ()).narrow (__c, __dflt);
++	// For better performance, call the non-const version of getloc
++	basic_ios<_CharT, _Traits>* p =
++	    const_cast<basic_ios<_CharT, _Traits>*>(this);
++
++        return _USE_FACET (ctype<char_type>, p->getloc()).narrow (__c, __dflt);
+     }
+ 
+     // 27.4.4.2, p11
+     char_type widen (char __c) const {
+-        return _USE_FACET (ctype<char_type>, getloc ()).widen (__c);
++	// For better performance, call the non-const version of getloc
++	basic_ios<_CharT, _Traits>* p =
++	    const_cast<basic_ios<_CharT, _Traits>*>(this);
++
++        return _USE_FACET (ctype<char_type>, p->getloc()).widen (__c);
+     }
+ 
+ protected: