summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
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)