summaryrefslogtreecommitdiff
path: root/qpid/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
commit2a9a32cbb79feb6d5714838006b42dece9879f6f (patch)
tree92ac37bf2c6f7a36825404d33a2ac6f1c0dce581 /qpid/cpp
parent981f2630442bffc998eeabb7ee438d6a9bce40ff (diff)
downloadqpid-python-2a9a32cbb79feb6d5714838006b42dece9879f6f.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@603719 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/InlineAllocator.h11
-rw-r--r--qpid/cpp/src/tests/unit_test.h1
2 files changed, 4 insertions, 8 deletions
diff --git a/qpid/cpp/src/qpid/InlineAllocator.h b/qpid/cpp/src/qpid/InlineAllocator.h
index 06f79c95e3..0bb30fa1a4 100644
--- a/qpid/cpp/src/qpid/InlineAllocator.h
+++ b/qpid/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/qpid/cpp/src/tests/unit_test.h b/qpid/cpp/src/tests/unit_test.h
index 83e2ce39f8..106d640d25 100644
--- a/qpid/cpp/src/tests/unit_test.h
+++ b/qpid/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)