Commit 954b12d2 by Paolo Carlini Committed by Paolo Carlini

basic_string.tcc (_S_construct(size_type, _CharT, const _Alloc&)): Remove redundant try/catch.

2004-01-19  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/basic_string.tcc (_S_construct(size_type,
	_CharT, const _Alloc&)): Remove redundant try/catch.
	(_M_mutate(size_type, size_type, size_type)): Ditto.
	(_M_clone(const _Alloc&, size_type)): Ditto.

From-SVN: r76141
parent 8c80adb7
2004-01-19 Paolo Carlini <pcarlini@suse.de>
* include/bits/basic_string.tcc (_S_construct(size_type,
_CharT, const _Alloc&)): Remove redundant try/catch.
(_M_mutate(size_type, size_type, size_type)): Ditto.
(_M_clone(const _Alloc&, size_type)): Ditto.
2004-01-18 Paolo Carlini <pcarlini@suse.de> 2004-01-18 Paolo Carlini <pcarlini@suse.de>
* include/bits/basic_string.h (c_str()): Simplify, due to * include/bits/basic_string.h (c_str()): Simplify, due to
......
...@@ -182,16 +182,9 @@ namespace std ...@@ -182,16 +182,9 @@ namespace std
// Check for out_of_range and length_error exceptions. // Check for out_of_range and length_error exceptions.
_Rep* __r = _Rep::_S_create(__n, __a); _Rep* __r = _Rep::_S_create(__n, __a);
try if (__n)
{ traits_type::assign(__r->_M_refdata(), __n, __c);
if (__n)
traits_type::assign(__r->_M_refdata(), __n, __c);
}
catch(...)
{
__r->_M_destroy(__a);
__throw_exception_again;
}
__r->_M_length = __n; __r->_M_length = __n;
__r->_M_refdata()[__n] = _Rep::_S_terminal; // grrr __r->_M_refdata()[__n] = _Rep::_S_terminal; // grrr
return __r->_M_refdata(); return __r->_M_refdata();
...@@ -442,19 +435,13 @@ namespace std ...@@ -442,19 +435,13 @@ namespace std
__new_size : 2*capacity(), __a); __new_size : 2*capacity(), __a);
else else
__r = _Rep::_S_create(__new_size, __a); __r = _Rep::_S_create(__new_size, __a);
try
{ if (__pos)
if (__pos) traits_type::copy(__r->_M_refdata(), _M_data(), __pos);
traits_type::copy(__r->_M_refdata(), _M_data(), __pos); if (__how_much)
if (__how_much) traits_type::copy(__r->_M_refdata() + __pos + __len2,
traits_type::copy(__r->_M_refdata() + __pos + __len2, __src, __how_much);
__src, __how_much);
}
catch(...)
{
__r->_M_dispose(get_allocator());
__throw_exception_again;
}
_M_rep()->_M_dispose(__a); _M_rep()->_M_dispose(__a);
_M_data(__r->_M_refdata()); _M_data(__r->_M_refdata());
} }
...@@ -603,18 +590,9 @@ namespace std ...@@ -603,18 +590,9 @@ namespace std
__r = _Rep::_S_create(__requested_cap, __alloc); __r = _Rep::_S_create(__requested_cap, __alloc);
if (this->_M_length) if (this->_M_length)
{ traits_type::copy(__r->_M_refdata(), _M_refdata(),
try this->_M_length);
{
traits_type::copy(__r->_M_refdata(), _M_refdata(),
this->_M_length);
}
catch(...)
{
__r->_M_destroy(__alloc);
__throw_exception_again;
}
}
__r->_M_length = this->_M_length; __r->_M_length = this->_M_length;
__r->_M_refdata()[this->_M_length] = _Rep::_S_terminal; __r->_M_refdata()[this->_M_length] = _Rep::_S_terminal;
return __r->_M_refdata(); return __r->_M_refdata();
......
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