Ticket #7227: boost-container.patch
File boost-container.patch, 7.0 KB (added by , 10 years ago) |
---|
-
boost/container/detail/tree.hpp
old new 262 262 if(NodePtr p = m_icont.unlink_leftmost_without_rebalance()){ 263 263 //First recycle a node (this can't throw) 264 264 //NodePtr p = m_icont.unlink_leftmost_without_rebalance(); 265 try{265 BOOST_TRY{ 266 266 //This can throw 267 267 *p = other; 268 268 return p; 269 269 } 270 catch(...){270 BOOST_CATCH(...){ 271 271 //If there is an exception destroy the whole source 272 272 m_holder.destroy_node(p); 273 273 while((p = m_icont.unlink_leftmost_without_rebalance())){ 274 274 m_holder.destroy_node(p); 275 275 } 276 throw;276 BOOST_RETHROW; 277 277 } 278 BOOST_CATCH_END 278 279 } 279 280 else{ 280 281 return m_holder.create_node(other); -
boost/container/detail/node_pool_impl.hpp
old new 302 302 size_type blocksize = 303 303 get_rounded_size(m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value); 304 304 305 try{305 BOOST_TRY{ 306 306 for(size_type i = 0; i != num_blocks; ++i){ 307 307 //We allocate a new NodeBlock and put it as first 308 308 //element in the free Node list … … 318 318 } 319 319 } 320 320 } 321 catch(...){321 BOOST_CATCH(...){ 322 322 //to-do: if possible, an efficient way to deallocate allocated blocks 323 throw;323 BOOST_RETHROW; 324 324 } 325 BOOST_CATCH_END 325 326 } 326 327 327 328 //!Deprecated, use deallocate_free_blocks -
boost/container/detail/advanced_insert_int.hpp
old new 16 16 #endif 17 17 18 18 #include "config_begin.hpp" 19 #include <boost/detail/no_exceptions_support.hpp> 19 20 #include <boost/container/detail/workaround.hpp> 20 21 #include <boost/move/move.hpp> 21 22 #include <iterator> //std::iterator_traits … … 101 102 BOOST_ASSERT(n <= count_); 102 103 Iterator orig_p = p; 103 104 SizeType i = 0; 104 try{105 BOOST_TRY{ 105 106 for(; i < n; ++i, ++p){ 106 107 new(containers_detail::get_pointer(&*p))T(); 107 108 } 108 109 } 109 catch(...){110 BOOST_CATCH(...){ 110 111 while(i--){ 111 112 containers_detail::get_pointer(&*orig_p++)->~T(); 112 113 } 113 throw;114 BOOST_RETHROW; 114 115 } 116 BOOST_CATCH_END 115 117 count_ -= n; 116 118 } 117 119 -
boost/container/detail/adaptive_node_pool_impl.hpp
old new 16 16 #endif 17 17 18 18 #include "config_begin.hpp" 19 #include <boost/detail/no_exceptions_support.hpp> 19 20 #include <boost/container/container_fwd.hpp> 20 21 #include <boost/container/detail/workaround.hpp> 21 22 #include <boost/container/detail/utilities.hpp> … … 254 255 { 255 256 multiallocation_chain chain; 256 257 size_type i = 0; 257 try{258 BOOST_TRY{ 258 259 priv_invariants(); 259 260 while(i != n){ 260 261 //If there are no free nodes we allocate all needed blocks … … 279 280 i += num_elems; 280 281 } 281 282 } 282 catch(...){283 BOOST_CATCH(...){ 283 284 this->deallocate_nodes(boost::move(chain)); 284 throw;285 BOOST_RETHROW; 285 286 } 287 BOOST_CATCH_END 286 288 priv_invariants(); 287 289 return boost::move(chain); 288 290 } -
boost/container/stable_vector.hpp
old new 1433 1433 void_ptr new_node(const void_ptr &up, Iter it) 1434 1434 { 1435 1435 node_type_ptr_t p = this->allocate_one(); 1436 try{1436 BOOST_TRY{ 1437 1437 boost::container::construct_in_place(&*p, it); 1438 1438 p->set_pointer(up); 1439 1439 } 1440 catch(...){1440 BOOST_CATCH(...){ 1441 1441 this->deallocate_one(p); 1442 throw;1442 BOOST_RETHROW 1443 1443 } 1444 BOOST_CATCH_END 1444 1445 return p; 1445 1446 } 1446 1447 … … 1499 1500 void insert_iter_fwd_alloc(const impl_iterator it, FwdIterator first, FwdIterator last, difference_type n, allocator_v1) 1500 1501 { 1501 1502 size_type i=0; 1502 try{1503 BOOST_TRY{ 1503 1504 while(first!=last){ 1504 1505 it[i] = this->new_node(void_ptr_ptr(&it[i]), first); 1505 1506 ++first; 1506 1507 ++i; 1507 1508 } 1508 1509 } 1509 catch(...){1510 BOOST_CATCH(...){ 1510 1511 impl_iterator e = impl.erase(it + i, it + n); 1511 1512 this->align_nodes(e, get_last_align()); 1512 throw;1513 BOOST_RETHROW 1513 1514 } 1515 BOOST_CATCH_END 1514 1516 } 1515 1517 1516 1518 template <class FwdIterator> … … 1520 1522 1521 1523 size_type i = 0; 1522 1524 node_type_ptr_t p = 0; 1523 try{1525 BOOST_TRY{ 1524 1526 while(first != last){ 1525 1527 p = mem.front(); 1526 1528 mem.pop_front(); … … 1532 1534 ++i; 1533 1535 } 1534 1536 } 1535 catch(...){1537 BOOST_CATCH(...){ 1536 1538 get_al().deallocate_one(p); 1537 1539 get_al().deallocate_many(boost::move(mem)); 1538 1540 impl_iterator e = impl.erase(it+i, it+n); 1539 1541 this->align_nodes(e, get_last_align()); 1540 throw;1542 BOOST_RETHROW 1541 1543 } 1544 BOOST_CATCH_END 1542 1545 } 1543 1546 1544 1547 template <class FwdIterator> … … 1546 1549 { 1547 1550 size_type i = 0; 1548 1551 node_type_ptr_t p = 0; 1549 try{1552 BOOST_TRY{ 1550 1553 while(first != last){ 1551 1554 p = get_from_pool(); 1552 1555 if(!p){ … … 1561 1564 ++i; 1562 1565 } 1563 1566 } 1564 catch(...){1567 BOOST_CATCH(...){ 1565 1568 put_in_pool(p); 1566 1569 impl_iterator e = impl.erase(it+i, it+n); 1567 1570 this->align_nodes(e, get_last_align()); 1568 throw;1571 BOOST_RETHROW 1569 1572 } 1573 BOOST_CATCH_END 1570 1574 } 1571 1575 1572 1576 template <class InputIterator> -
boost/container/vector.hpp
old new 1932 1932 { 1933 1933 //If n is out of range, throw an out_of_range exception 1934 1934 if (n >= size()) 1935 throw std::out_of_range("vector::at");1935 BOOST_THROW_EXCEPTION(std::out_of_range("vector::at")); 1936 1936 } 1937 1937 1938 1938 #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS -
boost/container/string.hpp
old new 1991 1991 size_type long_size = this->priv_long_size(); 1992 1992 size_type long_storage = this->priv_long_storage(); 1993 1993 //We can make this nothrow as chars are always NoThrowCopyables 1994 try{1994 BOOST_TRY{ 1995 1995 std::pair<pointer, bool> ret = this->allocation_command 1996 1996 (allocate_new, long_size+1, long_size+1, real_cap, long_addr); 1997 1997 //Copy and update … … 2003 2003 //And release old buffer 2004 2004 this->alloc().deallocate(long_addr, long_storage); 2005 2005 } 2006 catch(...){2006 BOOST_CATCH(...){ 2007 2007 return; 2008 2008 } 2009 BOOST_CATCH_END 2009 2010 } 2010 2011 2011 2012 void priv_shrink_to_fit_dynamic_buffer(allocator_v2)