testsuite_allocator.h (tracker_allocator_counter:: allocate): Update allocation count...
authorFrançois Dumont <fdumont@gcc.gnu.org>
Fri, 2 Sep 2011 15:54:16 +0000 (15:54 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 2 Sep 2011 15:54:16 +0000 (15:54 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/util/testsuite_allocator.h

index d655cc4dd57830398385ec719c9b550d6d48c56d..5d34b2b419f7efaf73cdd0585e26dbb6b032a972 100644 (file)
@@ -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.
index 279c42d1a30a1e29894c66468dbcc5eecd181c21..57a5a8ae896e1117f38f7e314cd3ac9e7d2854ce 100644 (file)
@@ -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()
     {