This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Alternate patch for libstdc++/4354
- To: libstdc++ at gcc dot gnu dot org
- Subject: Alternate patch for libstdc++/4354
- From: Paolo Carlini <pcarlini at unitus dot it>
- Date: Sat, 22 Sep 2001 20:18:16 +0200
- CC: bkoz at redhat dot com, pme at gcc dot gnu dot org
- Organization: Universita' della Tuscia
- Reply-To: pcarlini at unitus dot it
Hi again.
A much cleaner, semantically equivalent, version of my previous patch is
also viable
(this one too regression tested i686-pc-linux-gnu)
Cheers,
Paolo Carlini.
*** basic_string.tcc.orig Sat Sep 22 19:56:58 2001
--- basic_string.tcc Sat Sep 22 20:04:32 2001
*************** namespace std
*** 453,462 ****
if (__dmax <= __dnew)
__throw_length_error("basic_string::_M_replace");
size_type __off = __i1 - _M_ibegin();
! _M_mutate(__off, __dold, __dnew);
! // Invalidated __i1, __i2
! if (__dnew)
! _S_copy_chars(_M_data() + __off, __k1, __k2);
return *this;
}
--- 453,470 ----
if (__dmax <= __dnew)
__throw_length_error("basic_string::_M_replace");
size_type __off = __i1 - _M_ibegin();
! if (__dnew < __dold)
! {
! if (__dnew)
! _S_copy_chars(_M_data() + __off, __k1, __k2);
! _M_mutate(__off, __dold, __dnew);
! }
! else
! {
! _M_mutate(__off, __dold, __dnew);
! if (__dnew)
! _S_copy_chars(_M_data() + __off, __k1, __k2);
! }
return *this;
}