mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 17:06:30 +00:00
refactor: move Arena and ArenaMem to memory_defs.h (#26240)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "nvim/macros.h"
|
||||
#include "nvim/memory_defs.h" // IWYU pragma: export
|
||||
|
||||
/// `malloc()` function signature
|
||||
typedef void *(*MemMalloc)(size_t);
|
||||
@@ -40,20 +41,6 @@ extern bool entered_free_all_mem;
|
||||
|
||||
EXTERN size_t arena_alloc_count INIT( = 0);
|
||||
|
||||
typedef struct consumed_blk {
|
||||
struct consumed_blk *prev;
|
||||
} *ArenaMem;
|
||||
|
||||
#define ARENA_ALIGN MAX(sizeof(void *), sizeof(double))
|
||||
|
||||
typedef struct {
|
||||
char *cur_blk;
|
||||
size_t pos, size;
|
||||
} Arena;
|
||||
|
||||
// inits an empty arena.
|
||||
#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))
|
||||
|
Reference in New Issue
Block a user