mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 07:16:09 +00:00
refactor(api): make cstr_as_string accept "const char*"
In the context a String inside an Object/Dictionary etc is consumed, it is considered to be read-only.
This commit is contained in:
@@ -977,12 +977,12 @@ void decor_to_dict_legacy(Dictionary *dict, DecorInline decor, bool hl_name, Are
|
||||
}
|
||||
|
||||
if (sh_hl.url != NULL) {
|
||||
PUT_C(*dict, "url", STRING_OBJ(cstr_as_string((char *)sh_hl.url)));
|
||||
PUT_C(*dict, "url", STRING_OBJ(cstr_as_string(sh_hl.url)));
|
||||
}
|
||||
|
||||
if (virt_text) {
|
||||
if (virt_text->hl_mode) {
|
||||
PUT_C(*dict, "hl_mode", CSTR_AS_OBJ((char *)hl_mode_str[virt_text->hl_mode]));
|
||||
PUT_C(*dict, "hl_mode", CSTR_AS_OBJ(hl_mode_str[virt_text->hl_mode]));
|
||||
}
|
||||
|
||||
Array chunks = virt_text_to_array(virt_text->data.virt_text, hl_name, arena);
|
||||
@@ -992,7 +992,7 @@ void decor_to_dict_legacy(Dictionary *dict, DecorInline decor, bool hl_name, Are
|
||||
if (virt_text->pos == kVPosWinCol) {
|
||||
PUT_C(*dict, "virt_text_win_col", INTEGER_OBJ(virt_text->col));
|
||||
}
|
||||
PUT_C(*dict, "virt_text_pos", CSTR_AS_OBJ((char *)virt_text_pos_str[virt_text->pos]));
|
||||
PUT_C(*dict, "virt_text_pos", CSTR_AS_OBJ(virt_text_pos_str[virt_text->pos]));
|
||||
priority = virt_text->priority;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user