summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-12-12 20:00:43 +0000
committerAlan Conway <aconway@apache.org>2007-12-12 20:00:43 +0000
commitb14bfb7293bca39ecdcd989c95b65671005997ae (patch)
tree4f2319737b35d00f631b28adf0a07d94d9ea5fcf /cpp
parent45cbaf3bf00000c16163468d77d1363171c69a66 (diff)
downloadqpid-python-b14bfb7293bca39ecdcd989c95b65671005997ae.tar.gz
src/qpid/InlineAllocator.h: Removed cast, causing problems on alpha platform.
src/tests/unit_test.h: Added missing #include <boost/version.hpp> git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@603719 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/InlineAllocator.h11
-rw-r--r--cpp/src/tests/unit_test.h1
2 files changed, 4 insertions, 8 deletions
diff --git a/cpp/src/qpid/InlineAllocator.h b/cpp/src/qpid/InlineAllocator.h
index 06f79c95e3..0bb30fa1a4 100644
--- a/cpp/src/qpid/InlineAllocator.h
+++ b/cpp/src/qpid/InlineAllocator.h
@@ -29,7 +29,6 @@ namespace qpid {
/**
* 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 @@ class InlineAllocator : public BaseAllocator {
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 @@ class InlineAllocator : public BaseAllocator {
};
private:
- value_type* data() {
- return reinterpret_cast<value_type*>(store);
- }
-
- char store[Max * sizeof(value_type)];
+ value_type store[Max];
bool allocated;
};
diff --git a/cpp/src/tests/unit_test.h b/cpp/src/tests/unit_test.h
index 83e2ce39f8..106d640d25 100644
--- a/cpp/src/tests/unit_test.h
+++ b/cpp/src/tests/unit_test.h
@@ -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)