From b14bfb7293bca39ecdcd989c95b65671005997ae Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 12 Dec 2007 20:00:43 +0000 Subject: src/qpid/InlineAllocator.h: Removed cast, causing problems on alpha platform. src/tests/unit_test.h: Added missing #include git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@603719 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/InlineAllocator.h | 11 +++-------- cpp/src/tests/unit_test.h | 1 + 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'cpp/src') 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 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(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 #if (BOOST_VERSION < 103400) -- cgit v1.2.1