From 01590c6f02af5de7844c7962b367fa7ae57fab30 Mon Sep 17 00:00:00 2001 From: paolo Date: Fri, 2 Sep 2011 15:54:16 +0000 Subject: =?UTF-8?q?2011-09-02=20=20Fran=C3=A7ois=20Dumont=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * testsuite/util/testsuite_allocator.h (tracker_allocator_counter:: allocate): Update allocation count only if allocation succeeded. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178486 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/testsuite/util/testsuite_allocator.h | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'libstdc++-v3') diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d655cc4dd57..5d34b2b419f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2011-09-02 François Dumont + + * testsuite/util/testsuite_allocator.h (tracker_allocator_counter:: + allocate): Update allocation count only if allocation succeeded. + 2011-09-02 Paolo Carlini * 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 279c42d1a30..57a5a8ae896 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() { -- cgit v1.2.1