diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-11-01 08:15:46 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-11-01 08:15:46 +0000 |
commit | 9427c3d324c63f8f2e3b42e616352ce2f6e2edfd (patch) | |
tree | a9d5b585584400fd7634fc2f58b6a78d7e9648d1 | |
parent | cf93eede6bbe790c8eda220fd2ac65a68941d687 (diff) | |
download | prick-9427c3d324c63f8f2e3b42e616352ce2f6e2edfd.tar.gz prick-9427c3d324c63f8f2e3b42e616352ce2f6e2edfd.tar.bz2 prick-9427c3d324c63f8f2e3b42e616352ce2f6e2edfd.zip |
Implement arena_reset
-rw-r--r-- | arena.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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); |