diff options
author | Martin Pärtel <martin.partel@gmail.com> | 2018-01-14 20:43:17 +0200 |
---|---|---|
committer | Martin Pärtel <martin.partel@gmail.com> | 2018-01-14 20:43:17 +0200 |
commit | d4a531b92d74171eccbebb9892a18cab63d370d7 (patch) | |
tree | f2ba5d8e81452a84c41ee18a49a1e398ecd936c2 /src/misc.h | |
parent | 4465f0e657ca97cf2e0001fcd0aadf0599564418 (diff) | |
download | bindfs-d4a531b92d74171eccbebb9892a18cab63d370d7.tar.gz |
Internal renames.
Diffstat (limited to 'src/misc.h')
-rw-r--r-- | src/misc.h | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -58,21 +58,21 @@ void grow_array_impl(void **array, int *capacity, int member_size); /* Returns 1 on success, 0 on syntax error. */ int parse_byte_count(const char *str, double *result); -/* Simple arena allocation for when it's convenient to - grow multiple times and deallocate all at once. */ -struct arena { +/* An allocation of contiguous memory with convenient functions for + growing it and appending to it. */ +struct memory_block { char *ptr; int size; int capacity; }; -#define ARENA_INITIALIZER { NULL, 0, 0 } +#define MEMORY_BLOCK_INITIALIZER { NULL, 0, 0 } -void init_arena(struct arena *a, int initial_capacity); -void grow_arena(struct arena *a, int amount); -int append_to_arena(struct arena *a, void *src, int src_size); -void free_arena(struct arena *a); +void init_memory_block(struct memory_block *a, int initial_capacity); +void grow_memory_block(struct memory_block *a, int amount); +int append_to_memory_block(struct memory_block *a, void *src, int src_size); +void free_memory_block(struct memory_block *a); -#define ARENA_GET(a, offset) (&(a).ptr[(offset)]) +#define MEMORY_BLOCK_GET(a, offset) (&(a).ptr[(offset)]) #endif |