Commit 0a746019 by Paolo Carlini Committed by Paolo Carlini

basic_string.tcc (_M_mutate): Don't compute __src unnecessarily.

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.

Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu>

From-SVN: r80952
parent 96d22b12
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:
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment