aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2011-09-02 15:54:16 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2011-09-02 15:54:16 +0000
commite1f3ce0db179a9c602c4699c517d9c689ebce34f (patch)
treea16b707f9a39d5054afb7799cd7f4550b526706d
parentd7da5cc85cdef4207d10e8b79dce79ed12353fb9 (diff)
downloadgcc-e1f3ce0db179a9c602c4699c517d9c689ebce34f.zip
gcc-e1f3ce0db179a9c602c4699c517d9c689ebce34f.tar.gz
gcc-e1f3ce0db179a9c602c4699c517d9c689ebce34f.tar.bz2
testsuite_allocator.h (tracker_allocator_counter:: allocate): Update allocation count only if allocation succeeded.
2011-09-02 François Dumont <fdumont@gcc.gnu.org> * testsuite/util/testsuite_allocator.h (tracker_allocator_counter:: allocate): Update allocation count only if allocation succeeded. From-SVN: r178486
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_allocator.h15
2 files changed, 13 insertions, 7 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index d655cc4..5d34b2b 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-02 François Dumont <fdumont@gcc.gnu.org>
+
+ * testsuite/util/testsuite_allocator.h (tracker_allocator_counter::
+ allocate): Update allocation count only if allocation succeeded.
+
2011-09-02 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/bitset: Trivial formatting fixes.
diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h
index 279c42d..57a5a8a 100644
--- a/libstdc++-v3/testsuite/util/testsuite_allocator.h
+++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h
@@ -37,14 +37,15 @@ namespace __gnu_test
{
public:
typedef std::size_t size_type;
-
+
static void*
allocate(size_type blocksize)
{
+ void* p = ::operator new(blocksize);
allocationCount_ += blocksize;
- return ::operator new(blocksize);
+ return p;
}
-
+
static void
construct() { constructCount_++; }
@@ -57,19 +58,19 @@ namespace __gnu_test
::operator delete(p);
deallocationCount_ += blocksize;
}
-
+
static size_type
get_allocation_count() { return allocationCount_; }
-
+
static size_type
get_deallocation_count() { return deallocationCount_; }
-
+
static int
get_construct_count() { return constructCount_; }
static int
get_destruct_count() { return destructCount_; }
-
+
static void
reset()
{