diff options
author | Omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-05-03 21:37:51 +1000 |
---|---|---|
committer | Omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-05-03 21:37:51 +1000 |
commit | aed7d1b7ac340c19656059c9cbd94aff40952f83 (patch) | |
tree | 9629cfda30456200e2496d0ac706de0002927614 /src/std/mem.c | |
parent | 8407723dfc12d302f6b696f702a5ae9caaf219c1 (diff) |
create logical device
Diffstat (limited to 'src/std/mem.c')
-rw-r--r-- | src/std/mem.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/std/mem.c b/src/std/mem.c index 5468898..4886d72 100644 --- a/src/std/mem.c +++ b/src/std/mem.c @@ -31,4 +31,11 @@ void arena_free_all(arena* a) { a->curr = a->begin; // pop everything at once and reset to the start. } -void arena_free_storage(arena* a) { free(a->begin); }
\ No newline at end of file +void arena_free_storage(arena* a) { free(a->begin); } + +arena_save arena_savepoint(arena* a) { + arena_save savept = { .arena = a, .savepoint = a->curr }; + return savept; +} + +void arena_rewind(arena_save savepoint) { savepoint.arena->curr = savepoint.savepoint; }
\ No newline at end of file |