diff options
| author | Alan Conway <aconway@apache.org> | 2008-04-21 16:36:08 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-04-21 16:36:08 +0000 |
| commit | a60ccdc6df3acd461c7e33c983d649563e4fbdc7 (patch) | |
| tree | e5058f48d40958a0c4ecdaecfc675a875ea3f21d /cpp/src/qpid/InlineAllocator.h | |
| parent | 61647950e1c4e6b1efb0a1b3f3b220783680103f (diff) | |
| download | qpid-python-a60ccdc6df3acd461c7e33c983d649563e4fbdc7.tar.gz | |
src/qpid/RangeSet.h: generic set implementation using ranges.
- no heap allocation for simple sets (<= 3 ranges)
- binary searches for o(log(n)) performance in complex sets
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@650198 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/InlineAllocator.h')
| -rw-r--r-- | cpp/src/qpid/InlineAllocator.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cpp/src/qpid/InlineAllocator.h b/cpp/src/qpid/InlineAllocator.h index 0bb30fa1a4..fd652aca03 100644 --- a/cpp/src/qpid/InlineAllocator.h +++ b/cpp/src/qpid/InlineAllocator.h @@ -23,6 +23,7 @@ */ #include <memory> +#include <assert.h> namespace qpid { @@ -49,7 +50,10 @@ class InlineAllocator : public BaseAllocator { } void deallocate(pointer p, size_type n) { - if (p == store) allocated=false; + if (p == store) { + assert(allocated); + allocated=false; + } else BaseAllocator::deallocate(p, n); } |
