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 _Safe_sequence_base::_M_revalidate_singular()


Hi,

while working on 29496 I noticed this long standing pasto, probably unreported to date only because this function is called only when the underlying unchecked operation throws (only two of them, only in list and deque).

Tested x86-linux, committed to mainline but I mean to apply it to 4_2 too if no issues arise.

Paolo.

//////////////
2006-10-29  Paolo Carlini  <pcarlini@suse.de>

	* src/debug.cc (_Safe_sequence_base::_M_revalidate_singular): Fix
	pasto, advance __iter only once per iteration.
Index: src/debug.cc
===================================================================
--- src/debug.cc	(revision 118136)
+++ src/debug.cc	(working copy)
@@ -146,23 +146,18 @@
 	  __old->_M_attach(0, true);
       }
   }
-  
-  void 
+
+  void
   _Safe_sequence_base::
   _M_revalidate_singular()
   {
-    _Safe_iterator_base* __iter;
-    for (__iter = _M_iterators; __iter; __iter = __iter->_M_next)
-      {
-	__iter->_M_version = _M_version;
-	__iter = __iter->_M_next;
-      }
-    
-    for (__iter = _M_const_iterators; __iter; __iter = __iter->_M_next)
-      {
-	__iter->_M_version = _M_version;
-	__iter = __iter->_M_next;
-      }
+    for (_Safe_iterator_base* __iter = _M_iterators; __iter;
+	 __iter = __iter->_M_next)
+      __iter->_M_version = _M_version;
+
+    for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;
+	 __iter2 = __iter2->_M_next)
+      __iter2->_M_version = _M_version;
   }
 
   void 

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