This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[v3] Fix 2 wrong comments and uses of char_traits::find


Hi,

for one, the implementation of char_traits::find() uses memchr,
not strchr; second, and more important, it's plainly false that
memchr(*, 0, *) matches always: see codecvt::do_out...

Tested x86-linux, committed.

Paolo.

/////////
2003-11-23  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/locale_facets.tcc (_M_extract_float,
	_M_extract_int): Remove a wrong comment and simplify
	the corresponding code using char_traits::find().
diff -urN libstdc++-v3-orig/include/bits/locale_facets.tcc libstdc++-v3/include/bits/locale_facets.tcc
--- libstdc++-v3-orig/include/bits/locale_facets.tcc	2003-11-17 09:52:05.000000000 +0100
+++ libstdc++-v3/include/bits/locale_facets.tcc	2003-11-23 13:35:59.000000000 +0100
@@ -175,8 +175,7 @@
 	  const char_type __c = *__beg;
           const char_type* __p = __traits_type::find(__lit + _S_izero, 10, 
 						     __c);
-          // NB: strchr returns true for __c == 0x0
-          if (__p && !__traits_type::eq(__c, char_type()))
+          if (__p)
 	    {
 	      // Try first for acceptable digit; record it if found.
 	      __xtrc += _S_atoms_in[__p - __lit];
@@ -352,8 +351,7 @@
 	  const char_type __c = *__beg;
           const char_type* __p = __traits_type::find(__lit + _S_izero,
 						     __len, __c);
-          // NB: strchr returns true for __c == 0x0
-          if (__p && !__traits_type::eq(__c, char_type()))
+          if (__p)
 	    {
 	      // Try first for acceptable digit; record it if found.
 	      __xtrc += _S_atoms_in[__p - __lit];

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