perf(highlight): allocate permanent names in an arena for fun and cache locality

This commit is contained in:
bfredl
2022-06-21 13:03:35 +02:00
parent 1dad288432
commit a9442c532e
3 changed files with 23 additions and 23 deletions

View File

@@ -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"