From 2a504224de6d0fdbfb980a1521ccf4a137278595 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 4 Jun 2016 16:23:31 +0900 Subject: [PATCH] nghttpx: Rename BlockAllocator::destroy as BlockAllocator::reset --- src/allocator.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/allocator.h b/src/allocator.h index 5a379ac0..c3302efc 100644 --- a/src/allocator.h +++ b/src/allocator.h @@ -54,7 +54,7 @@ struct BlockAllocator { block_size(block_size), isolation_threshold(std::min(block_size, isolation_threshold)) {} - ~BlockAllocator() { destroy(); } + ~BlockAllocator() { reset(); } BlockAllocator(BlockAllocator &&other) noexcept : retain(other.retain), @@ -66,7 +66,7 @@ struct BlockAllocator { } BlockAllocator &operator=(BlockAllocator &&other) noexcept { - destroy(); + reset(); retain = other.retain; head = other.head; @@ -82,12 +82,15 @@ struct BlockAllocator { BlockAllocator(const BlockAllocator &) = delete; BlockAllocator &operator=(const BlockAllocator &) = delete; - void destroy() { + void reset() { for (auto mb = retain; mb;) { auto next = mb->next; delete[] reinterpret_cast(mb); mb = next; } + + retain = nullptr; + head = nullptr; } MemBlock *alloc_mem_block(size_t size) {