summaryrefslogtreecommitdiff
path: root/arena.h
diff options
context:
space:
mode:
Diffstat (limited to 'arena.h')
-rw-r--r--arena.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arena.h b/arena.h
index 319384c..9432ff4 100644
--- a/arena.h
+++ b/arena.h
@@ -157,6 +157,15 @@ uint8_t *arena_realloc(arena_t *arena, uint8_t *pointer, uint32_t old_size,
return new_ptr;
}
+void arena_reset(arena_t *arena)
+{
+ for (region_t *region = arena->beg; region; region = region->next)
+ {
+ region->size = 0;
+ memset(region->bytes, 0, region->capacity);
+ }
+}
+
void arena_free(arena_t *arena)
{
region_delete_rec(arena->beg);