sso_string_base.h (__sso_string_base<>::_M_swap): Change the various traits_type::copy call to always copy the entire local buffer...
2005-11-03 Paolo Carlini <pcarlini@suse.de> * include/ext/sso_string_base.h (__sso_string_base<>::_M_swap): Change the various traits_type::copy call to always copy the entire local buffer; return early and don't do a full swap on the lengths for two common cases; change two _S_copy to plain traits_type::copy. From-SVN: r106431
This commit is contained in:
parent
02f1d17ccc
commit
f9c4ee6d10
2 changed files with 23 additions and 10 deletions
|
@ -1,3 +1,11 @@
|
|||
2005-11-03 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* include/ext/sso_string_base.h (__sso_string_base<>::_M_swap):
|
||||
Change the various traits_type::copy call to always copy the
|
||||
entire local buffer; return early and don't do a full swap on
|
||||
the lengths for two common cases; change two _S_copy to plain
|
||||
traits_type::copy.
|
||||
|
||||
2005-11-02 Thomas Kho <tkho@ucla.edu>
|
||||
|
||||
PR libstdc++/23425
|
||||
|
|
|
@ -255,29 +255,34 @@ namespace __gnu_cxx
|
|||
{
|
||||
_CharT __tmp_data[_S_local_capacity + 1];
|
||||
traits_type::copy(__tmp_data, __rcs._M_local_data,
|
||||
__rcs._M_length() + 1);
|
||||
_S_local_capacity + 1);
|
||||
traits_type::copy(__rcs._M_local_data, _M_local_data,
|
||||
_M_length() + 1);
|
||||
_S_local_capacity + 1);
|
||||
traits_type::copy(_M_local_data, __tmp_data,
|
||||
__rcs._M_length() + 1);
|
||||
_S_local_capacity + 1);
|
||||
}
|
||||
else if (__rcs._M_length())
|
||||
{
|
||||
traits_type::copy(_M_local_data, __rcs._M_local_data,
|
||||
__rcs._M_length() + 1);
|
||||
traits_type::assign(__rcs._M_local_data[0], _CharT());
|
||||
_S_local_capacity + 1);
|
||||
_M_length(__rcs._M_length());
|
||||
__rcs._M_set_length(0);
|
||||
return;
|
||||
}
|
||||
else if (_M_length())
|
||||
{
|
||||
traits_type::copy(__rcs._M_local_data, _M_local_data,
|
||||
_M_length() + 1);
|
||||
traits_type::assign(_M_local_data[0], _CharT());
|
||||
_S_local_capacity + 1);
|
||||
__rcs._M_length(_M_length());
|
||||
_M_set_length(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const size_type __tmp_capacity = __rcs._M_allocated_capacity;
|
||||
_S_copy(__rcs._M_local_data, _M_local_data, _M_length() + 1);
|
||||
traits_type::copy(__rcs._M_local_data, _M_local_data,
|
||||
_S_local_capacity + 1);
|
||||
_M_data(__rcs._M_data());
|
||||
__rcs._M_data(__rcs._M_local_data);
|
||||
_M_capacity(__tmp_capacity);
|
||||
|
@ -287,8 +292,8 @@ namespace __gnu_cxx
|
|||
const size_type __tmp_capacity = _M_allocated_capacity;
|
||||
if (__rcs._M_is_local())
|
||||
{
|
||||
_S_copy(_M_local_data, __rcs._M_local_data,
|
||||
__rcs._M_length() + 1);
|
||||
traits_type::copy(_M_local_data, __rcs._M_local_data,
|
||||
_S_local_capacity + 1);
|
||||
__rcs._M_data(_M_data());
|
||||
_M_data(_M_local_data);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue