This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Avoid __uselocale in config/locale/gnu/numeric_members.cc


Hi,

this one can definitely be spared, since btowc is called for the
following chars:

-+xX0123456789abcdefABCDEF

that all belong to the basic character set. Actually, we could even
pick the ISO 10646 Basic Latin block and put the values in a table,
but I'm too lazy today ;)

Tested x86-linux, will wait 'til tomorrow in case I'm missing something
and Nathan, Martin, others want to avoid me making a mistake

Paolo

////////////
2004-04-12  Paolo Carlini <pcarlini@suse.de>

	* config/locale/gnu/numeric_members.cc
	(numpunct<wchar_t>::_M_initialize_numpunct): No need to wrap
	in __uselocale, since btowc is called for chars belonging to
	the basic character set.
diff -urN libstdc++-v3-orig/config/locale/gnu/numeric_members.cc libstdc++-v3/config/locale/gnu/numeric_members.cc
--- libstdc++-v3-orig/config/locale/gnu/numeric_members.cc	2004-04-07 16:32:47.000000000 +0200
+++ libstdc++-v3/config/locale/gnu/numeric_members.cc	2004-04-11 17:04:45.000000000 +0200
@@ -106,9 +106,6 @@
 	  _M_data->_M_decimal_point = L'.';
 	  _M_data->_M_thousands_sep = L',';
 
-#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-	  __c_locale __old = __uselocale(_S_get_c_locale());
-#endif
 	  // Use ctype::widen code without the facet...
 	  unsigned char uc;
 	  for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
@@ -122,9 +119,6 @@
 	      uc = static_cast<unsigned char>(__num_base::_S_atoms_in[__i]);
 	      _M_data->_M_atoms_in[__i] = btowc(uc);
 	    }
-#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-	  __uselocale(__old);
-#endif
 	}
       else
 	{

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]