diff options
author | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
commit | 308e1940dcd64aa6c344c403d4f9e0dda58d9c5c (patch) | |
tree | 35fe43e01755e0f312650667004487a44d6b7941 /src/nvim/memory.h | |
parent | 96a00c7c588b2f38a2424aeeb4ea3581d370bf2d (diff) | |
parent | e8c94697bcbe23a5c7b07c292b90a6b70aadfa87 (diff) | |
download | rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.gz rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.bz2 rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.zip |
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'src/nvim/memory.h')
-rw-r--r-- | src/nvim/memory.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/memory.h b/src/nvim/memory.h index a4be2643d8..63d607c2ce 100644 --- a/src/nvim/memory.h +++ b/src/nvim/memory.h @@ -37,6 +37,24 @@ extern MemRealloc mem_realloc; extern bool entered_free_all_mem; #endif +typedef struct consumed_blk { + struct consumed_blk *prev; +} *ArenaMem; + +#define ARENA_ALIGN sizeof(void *) + +typedef struct { + char *cur_blk; + size_t pos, size; +} Arena; + +// inits an empty arena. use arena_start() to actually allocate space! +#define ARENA_EMPTY { .cur_blk = NULL, .pos = 0, .size = 0 } + +#define kv_fixsize_arena(a, v, s) \ + ((v).capacity = (s), \ + (v).items = (void *)arena_alloc(a, sizeof((v).items[0]) * (v).capacity, true)) + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "memory.h.generated.h" #endif |