basic_string.tcc (_S_construct(size_type, _CharT, const _Alloc&)): Remove redundant...
authorPaolo Carlini <pcarlini@suse.de>
Mon, 19 Jan 2004 08:53:32 +0000 (08:53 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 19 Jan 2004 08:53:32 +0000 (08:53 +0000)
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

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

index b8e326534b70d2e4bb5f68516f2544f0bf721cec..adf7bffc91b8807e2fbe90c7ad5ec6e2b03e3f52 100644 (file)
@@ -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
index bb39df3f370ffb1f7ea176f1ff3b1f2fb63203d4..5809d2a340ede83d836b81aa1d8c5df330756e85 100644 (file)
@@ -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();