From 138bf8267bb1c160a7d3dc49efe00003cb9a7683 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Tue, 10 Oct 2023 15:05:22 -0700 Subject: [PATCH] Code cleanups and doc updates. --- Arena.cc | 11 ----------- Arena.h | 8 +------- klib.h | 8 ++++++++ 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Arena.cc b/Arena.cc index ccdb3c7..37f8f6b 100644 --- a/Arena.cc +++ b/Arena.cc @@ -39,17 +39,6 @@ Arena::~Arena() } -void -Arena::Initialize() -{ - assert(this->arenaType != ArenaType::Uninit); - this->store = nullptr; - this->size = 0; - this->arenaType = ArenaType::Uninit; - this->fd = 0; -} - - int Arena::SetStatic(uint8_t *mem, size_t memSize) { diff --git a/Arena.h b/Arena.h index f9cf098..0d75d90 100644 --- a/Arena.h +++ b/Arena.h @@ -58,7 +58,7 @@ enum class ArenaType /// #NewCursor and #End methods return pointers to the start and end of the /// arena memory. /// -/// The arena should be initalized with one of the Set methods (SetStatic, +/// The arena should be initialized with one of the Set methods (SetStatic, /// SetAlloc) or one of the file-based options (Create, Open, MemoryMap). At /// this point, no further memory management should be done until the end of the /// arena's life, at which point Destroy should be called. @@ -69,12 +69,6 @@ public: ~Arena(); - /// Initialize is intended for use only with systems that do not - /// initialize new variables to zero. It should be called exactly once, - /// at the start of the program. Any other time the arena needs to be - /// reset, it should be called with #Clear or #Destroy. - void Initialize(); - /// SetStatic points the arena to a chunk of memory. That memory is /// intended to be statically allocated, e.g. via a global `static /// uint8_t memory[memSize];`. If the arena is already backed, then diff --git a/klib.h b/klib.h index 077a8aa..47d7bd0 100644 --- a/klib.h +++ b/klib.h @@ -57,6 +57,14 @@ namespace klib { /// Arena, TLV::Record to store the records, and finally Dictionary to make use /// of both of them. /// +/// Closely related to this, I've been working on building an ARM-based handheld +/// computer, for which I would also need a memory arena. +/// +/// \subsection The text editors +/// +/// Some time ago, I wrote a console text editor of my own; then later, started +/// working on a graphical editor. For this, I needed some data structures to +/// manage memory in the editor. Thus, Buffer was born. ///