|
Boost-Commit : |
From: daniel_james_at_[hidden]
Date: 2008-01-07 15:06:15
Author: danieljames
Date: 2008-01-07 15:06:15 EST (Mon, 07 Jan 2008)
New Revision: 42580
URL: http://svn.boost.org/trac/boost/changeset/42580
Log:
Avoid some uses of an invalid pointer.
Text files modified:
trunk/libs/unordered/test/objects/test.hpp | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
Modified: trunk/libs/unordered/test/objects/test.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/test.hpp (original)
+++ trunk/libs/unordered/test/objects/test.hpp 2008-01-07 15:06:15 EST (Mon, 07 Jan 2008)
@@ -311,11 +311,14 @@
{
allocated_memory_type::iterator pos
= allocated_memory.find(memory_area(ptr, ptr));
- if(pos == allocated_memory.end())
+ if(pos == allocated_memory.end()) {
BOOST_ERROR("Constructing unknown pointer.");
- BOOST_TEST(pos->second.tag_ == tag);
+ }
+ else {
+ BOOST_TEST(pos->second.tag_ == tag);
+ ++pos->second.constructed_;
+ }
++count_constructions;
- ++pos->second.constructed_;
}
void track_destroy(void* ptr, std::size_t /*size*/, int tag)
@@ -324,11 +327,13 @@
= allocated_memory.find(memory_area(ptr, ptr));
if(pos == allocated_memory.end())
BOOST_ERROR("Destroying unknown pointer.");
+ else {
+ BOOST_TEST(pos->second.tag_ == tag);
+ BOOST_TEST(pos->second.constructed_ > 0);
+ if(pos->second.constructed_ > 0) --pos->second.constructed_;
+ }
BOOST_TEST(count_constructions > 0);
- BOOST_TEST(pos->second.tag_ == tag);
- BOOST_TEST(pos->second.constructed_ > 0);
if(count_constructions > 0) --count_constructions;
- if(pos->second.constructed_ > 0) --pos->second.constructed_;
}
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk