about summary refs log tree commit diff stats
path: root/arena.h
diff options
context:
space:
mode:
authorPeter H. Froehlich <peter.hans.froehlich@gmail.com>2021-02-13 20:06:01 +0100
committerPeter H. Froehlich <peter.hans.froehlich@gmail.com>2021-02-13 20:06:01 +0100
commit8eee983028751ef16f0700eae777a48b10e722b6 (patch)
tree3422b4317fb12a576992f7ceb3c25c697e0f60bb /arena.h
parentf94fcf7052d45be9842bca09d813b45e3da8d0c3 (diff)
downloadsimple-allocators-8eee983028751ef16f0700eae777a48b10e722b6.tar.gz
Big-ish rework and cleanup; a README even.
Diffstat (limited to 'arena.h')
-rw-r--r--arena.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/arena.h b/arena.h
index 43ce053..5bc4c69 100644
--- a/arena.h
+++ b/arena.h
@@ -3,15 +3,34 @@
 #ifndef ARENA_H_
 #define ARENA_H_
 
+#include <stddef.h>
+
+/**
+ * Create arena holding up to `arena_size` bytes.
+ * Return 0 on success, <0 on failure.
+ */
 int
-ar_setup(size_t total_size);
+ar_setup(size_t arena_size);
 
+/**
+ * Allocate `object_size` bytes from the arena.
+ * Return NULL on failure.
+ */
 void *
 ar_alloc(size_t object_size);
 
+/**
+ * Free all allocations made in the arena.
+ * Invalidates all pointers you may still be holding.
+ * The arena still exists, ready for `ar_alloc` calls.
+ */
 void
 ar_free(void);
 
+/**
+ * Destroy the arena, freeing all memory allocated in `ar_setup`.
+ * Invalidates all pointers you may still be holding.
+ */
 void
 ar_cleanup(void);