Code cleanups and doc updates.

This commit is contained in:
Kyle Isom 2023-10-10 15:05:22 -07:00
parent eb665bdd92
commit 138bf8267b
3 changed files with 9 additions and 18 deletions

View File

@ -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 int
Arena::SetStatic(uint8_t *mem, size_t memSize) Arena::SetStatic(uint8_t *mem, size_t memSize)
{ {

View File

@ -58,7 +58,7 @@ enum class ArenaType
/// #NewCursor and #End methods return pointers to the start and end of the /// #NewCursor and #End methods return pointers to the start and end of the
/// arena memory. /// 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 /// 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 /// this point, no further memory management should be done until the end of the
/// arena's life, at which point Destroy should be called. /// arena's life, at which point Destroy should be called.
@ -69,12 +69,6 @@ public:
~Arena(); ~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 /// SetStatic points the arena to a chunk of memory. That memory is
/// intended to be statically allocated, e.g. via a global `static /// intended to be statically allocated, e.g. via a global `static
/// uint8_t memory[memSize];`. If the arena is already backed, then /// uint8_t memory[memSize];`. If the arena is already backed, then

8
klib.h
View File

@ -57,6 +57,14 @@ namespace klib {
/// Arena, TLV::Record to store the records, and finally Dictionary to make use /// Arena, TLV::Record to store the records, and finally Dictionary to make use
/// of both of them. /// 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.
/// ///