You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2007/12/12 21:00:44 UTC

svn commit: r603719 - in /incubator/qpid/trunk/qpid/cpp/src: qpid/InlineAllocator.h tests/unit_test.h

Author: aconway
Date: Wed Dec 12 12:00:43 2007
New Revision: 603719

URL: http://svn.apache.org/viewvc?rev=603719&view=rev
Log:
src/qpid/InlineAllocator.h: Removed cast, causing problems on alpha platform.
src/tests/unit_test.h: Added missing #include <boost/version.hpp>

Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/InlineAllocator.h
    incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/InlineAllocator.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/InlineAllocator.h?rev=603719&r1=603718&r2=603719&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/InlineAllocator.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/InlineAllocator.h Wed Dec 12 12:00:43 2007
@@ -29,7 +29,6 @@
 /**
  * An allocator that has inline storage for up to Max objects
  * of type BaseAllocator::value_type.
- * Store small requests inline, uses BaseAllocator::allocate otherwise.
  */
 template <class BaseAllocator, size_t Max> 
 class InlineAllocator : public BaseAllocator {
@@ -43,14 +42,14 @@
     pointer allocate(size_type n) {
         if (n <= Max && !allocated) {
             allocated=true;
-            return data();
+            return store;
         }
         else 
             return BaseAllocator::allocate(n, 0);
     }
 
     void deallocate(pointer p, size_type n) {
-        if (p == data()) allocated=false;
+        if (p == store) allocated=false;
         else BaseAllocator::deallocate(p, n);
     }
 
@@ -61,11 +60,7 @@
     };
 
   private:
-    value_type* data() {
-        return reinterpret_cast<value_type*>(store);
-    }
-
-    char store[Max * sizeof(value_type)];
+    value_type store[Max];
     bool allocated;
 };
 

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h?rev=603719&r1=603718&r2=603719&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/unit_test.h Wed Dec 12 12:00:43 2007
@@ -25,6 +25,7 @@
 // Workaround so we can build against boost 1.33 and boost 1.34.
 // Remove when we no longer need to support 1.33.
 // 
+#include <boost/version.hpp>
 
 #if (BOOST_VERSION < 103400)