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] Patchlet for missing _GLIBCXX_DEBUG_PEDASSERT


Hi,

straightforward fix and a little bit of clean-up. I'm applying
this to 3_4 too.

Tested x86-linux.

Paolo.

/////////////
2004-01-26  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/basic_string.h (replace(iterator, iterator,
	const basic_string&)): Remove _GLIBCXX_DEBUG_PEDASSERT.
	(replace(iterator, iterator, const _CharT*)): Ditto.
	(replace(iterator, iterator, const _CharT*, size_type)):
	Add missing _GLIBCXX_DEBUG_PEDASSERT.
	
diff -urN libstdc++-v3-orig/include/bits/basic_string.h libstdc++-v3/include/bits/basic_string.h
--- libstdc++-v3-orig/include/bits/basic_string.h	2004-01-25 22:20:38.000000000 +0100
+++ libstdc++-v3/include/bits/basic_string.h	2004-01-26 13:34:38.000000000 +0100
@@ -1209,11 +1209,7 @@
       */
       basic_string&
       replace(iterator __i1, iterator __i2, const basic_string& __str)
-      { 
-	_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
-				 && __i2 <= _M_iend());
-	return this->replace(__i1, __i2, __str._M_data(), __str.size()); 
-      }
+      { return this->replace(__i1, __i2, __str._M_data(), __str.size()); }
 
       /**
        *  @brief  Replace range of characters with C substring.
@@ -1230,9 +1226,12 @@
        *  change if an error is thrown.
       */
       basic_string&
-      replace(iterator __i1, iterator __i2,
-	      const _CharT* __s, size_type __n)
-      { return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n); }
+      replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)
+      {
+	_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+				 && __i2 <= _M_iend());	
+	return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
+      }
 
       /**
        *  @brief  Replace range of characters with C string.
@@ -1250,8 +1249,6 @@
       basic_string&
       replace(iterator __i1, iterator __i2, const _CharT* __s)
       { 
-	_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
-				 && __i2 <= _M_iend());
 	__glibcxx_requires_string(__s);
 	return this->replace(__i1, __i2, __s, traits_type::length(__s)); 
       }

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