From ddef9281741e3216760a714a8a1d23bfba01a252 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 13 Aug 2024 22:20:17 -0400 Subject: [PATCH] Change arena require to initialize, default to nullptr. --- include/bitcoin/node/block_arena.hpp | 2 +- src/block_arena.cpp | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/bitcoin/node/block_arena.hpp b/include/bitcoin/node/block_arena.hpp index 2ac4cced..59c2f4ba 100644 --- a/include/bitcoin/node/block_arena.hpp +++ b/include/bitcoin/node/block_arena.hpp @@ -40,7 +40,7 @@ class BCN_API block_arena final block_arena& operator=(block_arena&& other) NOEXCEPT; - void* require(size_t bytes) NOEXCEPT override; + void* initialize() NOEXCEPT override; private: void* do_allocate(size_t bytes, size_t align) THROWS override; diff --git a/src/block_arena.cpp b/src/block_arena.cpp index 7671c9ae..bec1c16e 100644 --- a/src/block_arena.cpp +++ b/src/block_arena.cpp @@ -82,12 +82,10 @@ size_t block_arena::capacity() const NOEXCEPT } // Bytes includes any expected alignment. -void* block_arena::require(size_t bytes) NOEXCEPT +void* block_arena::initialize() NOEXCEPT { - if (bytes > capacity()) - offset_ = zero; - - return memory_map_ + offset_; + offset_ = zero; + return memory_map_; } void* block_arena::do_allocate(size_t bytes, size_t align) THROWS