diff options
Diffstat (limited to 'memstack/include')
-rw-r--r-- | memstack/include/memstack.h | 10 |
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*); | |||
33 | void memstack_clear(memstack*); | 33 | void 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. |
41 | void* memstack_alloc(memstack*, size_t bytes); | 44 | void* 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(). | ||
51 | void* 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. |
44 | size_t memstack_size(const memstack*); | 54 | size_t memstack_size(const memstack*); |
45 | 55 | ||