nghttpx: Rename BlockAllocator::destroy as BlockAllocator::reset

This commit is contained in:
Tatsuhiro Tsujikawa 2016-06-04 16:23:31 +09:00
parent d0bf247419
commit 2a504224de
1 changed files with 6 additions and 3 deletions

View File

@ -54,7 +54,7 @@ struct BlockAllocator {
block_size(block_size), block_size(block_size),
isolation_threshold(std::min(block_size, isolation_threshold)) {} isolation_threshold(std::min(block_size, isolation_threshold)) {}
~BlockAllocator() { destroy(); } ~BlockAllocator() { reset(); }
BlockAllocator(BlockAllocator &&other) noexcept BlockAllocator(BlockAllocator &&other) noexcept
: retain(other.retain), : retain(other.retain),
@ -66,7 +66,7 @@ struct BlockAllocator {
} }
BlockAllocator &operator=(BlockAllocator &&other) noexcept { BlockAllocator &operator=(BlockAllocator &&other) noexcept {
destroy(); reset();
retain = other.retain; retain = other.retain;
head = other.head; head = other.head;
@ -82,12 +82,15 @@ struct BlockAllocator {
BlockAllocator(const BlockAllocator &) = delete; BlockAllocator(const BlockAllocator &) = delete;
BlockAllocator &operator=(const BlockAllocator &) = delete; BlockAllocator &operator=(const BlockAllocator &) = delete;
void destroy() { void reset() {
for (auto mb = retain; mb;) { for (auto mb = retain; mb;) {
auto next = mb->next; auto next = mb->next;
delete[] reinterpret_cast<uint8_t *>(mb); delete[] reinterpret_cast<uint8_t *>(mb);
mb = next; mb = next;
} }
retain = nullptr;
head = nullptr;
} }
MemBlock *alloc_mem_block(size_t size) { MemBlock *alloc_mem_block(size_t size) {