OSDN Git Service

2004-04-21 Paolo Carlini <pcarlini@suse.de>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Apr 2004 09:23:36 +0000 (09:23 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Apr 2004 09:23:36 +0000 (09:23 +0000)
    Andrew Pinski  <pinskia@physics.uc.edu>

* include/bits/basic_string.tcc (_M_mutate): Don't compute
__src unnecessarily.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80952 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/basic_string.tcc

index 446ae40..5f760d2 100644 (file)
@@ -1,3 +1,9 @@
+2004-04-21  Paolo Carlini  <pcarlini@suse.de>
+           Andrew Pinski  <pinskia@physics.uc.edu>
+
+       * include/bits/basic_string.tcc (_M_mutate): Don't compute
+       __src unnecessarily.
+
 2004-04-19  Benjamin Kosnik  <bkoz@redhat.com>
 
        * testsuite/27_io/basic_istream/extractors_character/char/9555-ic.cc: 
index 4fa5e87..8f60abe 100644 (file)
@@ -383,7 +383,6 @@ namespace std
     {
       const size_type __old_size = this->size();
       const size_type __new_size = __old_size + __len2 - __len1;
-      const _CharT*        __src = _M_data()  + __pos + __len1;
       const size_type __how_much = __old_size - __pos - __len1;
 
       if (_M_rep() == &_S_empty_rep()
@@ -397,7 +396,7 @@ namespace std
            traits_type::copy(__r->_M_refdata(), _M_data(), __pos);
          if (__how_much)
            traits_type::copy(__r->_M_refdata() + __pos + __len2,
-                             __src, __how_much);
+                             _M_data() + __pos + __len1, __how_much);
 
          _M_rep()->_M_dispose(__a);
          _M_data(__r->_M_refdata());
@@ -405,7 +404,8 @@ namespace std
       else if (__how_much && __len1 != __len2)
        {
          // Work in-place
-         traits_type::move(_M_data() + __pos + __len2, __src, __how_much);
+         traits_type::move(_M_data() + __pos + __len2,
+                           _M_data() + __pos + __len1, __how_much);
        }
       _M_rep()->_M_set_sharable();
       _M_rep()->_M_length = __new_size;