mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 18:36:30 +00:00
Merge pull request #19039 from bfredl/multicolor
perf: get rid of unnecessary allocations in highlight groups
This commit is contained in:
@@ -686,10 +686,7 @@ Dictionary arena_dict(Arena *arena, size_t max_size)
|
||||
String arena_string(Arena *arena, String str)
|
||||
{
|
||||
if (str.size) {
|
||||
char *mem = arena_alloc(arena, str.size + 1, false);
|
||||
memcpy(mem, str.data, str.size);
|
||||
mem[str.size] = NUL;
|
||||
return cbuf_as_string(mem, str.size);
|
||||
return cbuf_as_string(arena_memdupz(arena, str.data, str.size), str.size);
|
||||
} else {
|
||||
return (String)STRING_INIT;
|
||||
}
|
||||
|
@@ -1293,7 +1293,8 @@ void nvim_unsubscribe(uint64_t channel_id, String event)
|
||||
Integer nvim_get_color_by_name(String name)
|
||||
FUNC_API_SINCE(1)
|
||||
{
|
||||
return name_to_color(name.data);
|
||||
int dummy;
|
||||
return name_to_color(name.data, &dummy);
|
||||
}
|
||||
|
||||
/// Returns a map of color names and RGB values.
|
||||
|
Reference in New Issue
Block a user