diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-06-21 13:03:35 +0200 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2022-06-21 18:40:35 +0200 |
commit | a9442c532e9af45fc5c79d0207ab837cb715941f (patch) | |
tree | ba4edafcdf0794250a6e63725233c12e15cb3d29 /src/nvim/memory.c | |
parent | 1dad288432d398dc1e4b5bbf1d72db7a488eb341 (diff) | |
download | rneovim-a9442c532e9af45fc5c79d0207ab837cb715941f.tar.gz rneovim-a9442c532e9af45fc5c79d0207ab837cb715941f.tar.bz2 rneovim-a9442c532e9af45fc5c79d0207ab837cb715941f.zip |
perf(highlight): allocate permanent names in an arena for fun and cache locality
Diffstat (limited to 'src/nvim/memory.c')
-rw-r--r-- | src/nvim/memory.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/memory.c b/src/nvim/memory.c index 9d02b83e5f..a615802b36 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -605,6 +605,14 @@ void arena_mem_free(ArenaMem mem, ArenaMem *reuse_blk) } } +char *arena_memdupz(Arena *arena, const char *buf, size_t size) +{ + char *mem = arena_alloc(arena, size + 1, false); + memcpy(mem, buf, size); + mem[size] = NUL; + return mem; +} + #if defined(EXITFREE) # include "nvim/buffer.h" |