aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2004-01-19 08:53:32 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2004-01-19 08:53:32 +0000
commit954b12d2dc0c85814de90bbe9e01869ded7bba1a (patch)
treee54d6719f1ac9bdd0393c2187c682728e676830b
parent8c80adb754abf2db9f949d2cc6047002d624411e (diff)
downloadgcc-954b12d2dc0c85814de90bbe9e01869ded7bba1a.zip
gcc-954b12d2dc0c85814de90bbe9e01869ded7bba1a.tar.gz
gcc-954b12d2dc0c85814de90bbe9e01869ded7bba1a.tar.bz2
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
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc48
2 files changed, 20 insertions, 35 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b8e3265..adf7bff 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+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>
* include/bits/basic_string.h (c_str()): Simplify, due to
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index bb39df3..5809d2a 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -182,16 +182,9 @@ namespace std
// Check for out_of_range and length_error exceptions.
_Rep* __r = _Rep::_S_create(__n, __a);
- try
- {
- if (__n)
- traits_type::assign(__r->_M_refdata(), __n, __c);
- }
- catch(...)
- {
- __r->_M_destroy(__a);
- __throw_exception_again;
- }
+ if (__n)
+ traits_type::assign(__r->_M_refdata(), __n, __c);
+
__r->_M_length = __n;
__r->_M_refdata()[__n] = _Rep::_S_terminal; // grrr
return __r->_M_refdata();
@@ -442,19 +435,13 @@ namespace std
__new_size : 2*capacity(), __a);
else
__r = _Rep::_S_create(__new_size, __a);
- try
- {
- if (__pos)
- traits_type::copy(__r->_M_refdata(), _M_data(), __pos);
- if (__how_much)
- traits_type::copy(__r->_M_refdata() + __pos + __len2,
- __src, __how_much);
- }
- catch(...)
- {
- __r->_M_dispose(get_allocator());
- __throw_exception_again;
- }
+
+ if (__pos)
+ traits_type::copy(__r->_M_refdata(), _M_data(), __pos);
+ if (__how_much)
+ traits_type::copy(__r->_M_refdata() + __pos + __len2,
+ __src, __how_much);
+
_M_rep()->_M_dispose(__a);
_M_data(__r->_M_refdata());
}
@@ -603,18 +590,9 @@ namespace std
__r = _Rep::_S_create(__requested_cap, __alloc);
if (this->_M_length)
- {
- try
- {
- traits_type::copy(__r->_M_refdata(), _M_refdata(),
- this->_M_length);
- }
- catch(...)
- {
- __r->_M_destroy(__alloc);
- __throw_exception_again;
- }
- }
+ traits_type::copy(__r->_M_refdata(), _M_refdata(),
+ this->_M_length);
+
__r->_M_length = this->_M_length;
__r->_M_refdata()[this->_M_length] = _Rep::_S_terminal;
return __r->_M_refdata();