aboutsummaryrefslogtreecommitdiff
path: root/memstack/include
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-07-14 09:30:08 -0700
committer3gg <3gg@shellblade.net>2025-07-14 09:30:08 -0700
commitff565e8d422c5e58558d1f7682ba0c9756e5be27 (patch)
tree46b417ee95896ca11e6638624d8ff8b638d123f9 /memstack/include
parent09166d46d6a30c1d431cc8371325d4fc8ae76162 (diff)
Add function to allocate aligned blocks on the memstackHEADmain
Diffstat (limited to 'memstack/include')
-rw-r--r--memstack/include/memstack.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/memstack/include/memstack.h b/memstack/include/memstack.h
index 9a8a7ee..97a9d12 100644
--- a/memstack/include/memstack.h
+++ b/memstack/include/memstack.h
@@ -33,13 +33,23 @@ void memstack_del(memstack*);
33void memstack_clear(memstack*); 33void memstack_clear(memstack*);
34 34
35/// Allocate a new block. 35/// Allocate a new block.
36///
36/// Return null if the block does not fit in the remaining memory. 37/// Return null if the block does not fit in the remaining memory.
38///
37/// When there is no space left in the stack, allocation can either trap 39/// When there is no space left in the stack, allocation can either trap
38/// (default) or gracefully return null. Call mem_enable_traps() to toggle this 40/// (default) or gracefully return null. Call mem_enable_traps() to toggle this
39/// behaviour. 41/// behaviour.
42///
40/// Newly allocated blocks are conveniently zeroed out. 43/// Newly allocated blocks are conveniently zeroed out.
41void* memstack_alloc(memstack*, size_t bytes); 44void* memstack_alloc(memstack*, size_t bytes);
42 45
46/// Allocate a new aligned block.
47///
48/// An alignment of 0 is allowed for convenience and has the same effect as 1.
49///
50/// Has the same properties as memstack_alloc().
51void* memstack_alloc_aligned(memstack*, size_t bytes, size_t alignment);
52
43/// Return the stack's used size in bytes. 53/// Return the stack's used size in bytes.
44size_t memstack_size(const memstack*); 54size_t memstack_size(const memstack*);
45 55