mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 07:28:34 +00:00
refactor: replace char_u with char (#21901)
refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
@@ -194,8 +194,8 @@ Array nvim_get_autocmds(Dict(get_autocmds) *opts, Error *err)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
snprintf((char *)pattern_buflocal, BUFLOCAL_PAT_LEN, "<buffer=%d>", (int)buf->handle);
|
||||
ADD(buffers, CSTR_TO_OBJ((char *)pattern_buflocal));
|
||||
snprintf(pattern_buflocal, BUFLOCAL_PAT_LEN, "<buffer=%d>", (int)buf->handle);
|
||||
ADD(buffers, CSTR_TO_OBJ(pattern_buflocal));
|
||||
} else if (opts->buffer.type == kObjectTypeArray) {
|
||||
if (opts->buffer.data.array.size > AUCMD_MAX_PATTERNS) {
|
||||
api_set_error(err,
|
||||
@@ -215,8 +215,8 @@ Array nvim_get_autocmds(Dict(get_autocmds) *opts, Error *err)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
snprintf((char *)pattern_buflocal, BUFLOCAL_PAT_LEN, "<buffer=%d>", (int)buf->handle);
|
||||
ADD(buffers, CSTR_TO_OBJ((char *)pattern_buflocal));
|
||||
snprintf(pattern_buflocal, BUFLOCAL_PAT_LEN, "<buffer=%d>", (int)buf->handle);
|
||||
ADD(buffers, CSTR_TO_OBJ(pattern_buflocal));
|
||||
});
|
||||
} else if (opts->buffer.type != kObjectTypeNil) {
|
||||
api_set_error(err, kErrorTypeValidation,
|
||||
@@ -319,7 +319,7 @@ Array nvim_get_autocmds(Dict(get_autocmds) *opts, Error *err)
|
||||
|
||||
PUT(autocmd_info,
|
||||
"pattern",
|
||||
STRING_OBJ(cstr_to_string((char *)ap->pat)));
|
||||
STRING_OBJ(cstr_to_string(ap->pat)));
|
||||
|
||||
PUT(autocmd_info,
|
||||
"event",
|
||||
@@ -934,7 +934,7 @@ static bool get_patterns_from_pattern_or_buf(Array *patterns, Object pattern, Ob
|
||||
char *pat = v->data.string.data;
|
||||
size_t patlen = aucmd_pattern_length(pat);
|
||||
while (patlen) {
|
||||
ADD(*patterns, STRING_OBJ(cbuf_to_string((char *)pat, patlen)));
|
||||
ADD(*patterns, STRING_OBJ(cbuf_to_string(pat, patlen)));
|
||||
|
||||
pat = aucmd_next_pattern(pat, patlen);
|
||||
patlen = aucmd_pattern_length(pat);
|
||||
@@ -949,7 +949,7 @@ static bool get_patterns_from_pattern_or_buf(Array *patterns, Object pattern, Ob
|
||||
char *pat = entry.data.string.data;
|
||||
size_t patlen = aucmd_pattern_length(pat);
|
||||
while (patlen) {
|
||||
ADD(*patterns, STRING_OBJ(cbuf_to_string((char *)pat, patlen)));
|
||||
ADD(*patterns, STRING_OBJ(cbuf_to_string(pat, patlen)));
|
||||
|
||||
pat = aucmd_next_pattern(pat, patlen);
|
||||
patlen = aucmd_pattern_length(pat);
|
||||
@@ -975,7 +975,7 @@ static bool get_patterns_from_pattern_or_buf(Array *patterns, Object pattern, Ob
|
||||
}
|
||||
|
||||
snprintf((char *)pattern_buflocal, BUFLOCAL_PAT_LEN, "<buffer=%d>", (int)buf->handle);
|
||||
ADD(*patterns, STRING_OBJ(cstr_to_string((char *)pattern_buflocal)));
|
||||
ADD(*patterns, STRING_OBJ(cstr_to_string(pattern_buflocal)));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -127,7 +127,7 @@ Dictionary nvim_parse_cmd(String str, Dictionary opts, Error *err)
|
||||
// otherwise split arguments by whitespace.
|
||||
if (ea.argt & EX_NOSPC) {
|
||||
if (*ea.arg != NUL) {
|
||||
ADD(args, STRING_OBJ(cstrn_to_string((char *)ea.arg, length)));
|
||||
ADD(args, STRING_OBJ(cstrn_to_string(ea.arg, length)));
|
||||
}
|
||||
} else {
|
||||
size_t end = 0;
|
||||
@@ -153,9 +153,9 @@ Dictionary nvim_parse_cmd(String str, Dictionary opts, Error *err)
|
||||
}
|
||||
|
||||
if (cmd != NULL) {
|
||||
PUT(result, "cmd", CSTR_TO_OBJ((char *)cmd->uc_name));
|
||||
PUT(result, "cmd", CSTR_TO_OBJ(cmd->uc_name));
|
||||
} else {
|
||||
PUT(result, "cmd", CSTR_TO_OBJ((char *)get_command_name(NULL, ea.cmdidx)));
|
||||
PUT(result, "cmd", CSTR_TO_OBJ(get_command_name(NULL, ea.cmdidx)));
|
||||
}
|
||||
|
||||
if (ea.argt & EX_RANGE) {
|
||||
@@ -237,7 +237,7 @@ Dictionary nvim_parse_cmd(String str, Dictionary opts, Error *err)
|
||||
break;
|
||||
}
|
||||
PUT(result, "addr", CSTR_TO_OBJ(addr));
|
||||
PUT(result, "nextcmd", CSTR_TO_OBJ((char *)ea.nextcmd));
|
||||
PUT(result, "nextcmd", CSTR_TO_OBJ(ea.nextcmd));
|
||||
|
||||
Dictionary mods = ARRAY_DICT_INIT;
|
||||
|
||||
|
@@ -554,7 +554,7 @@ static void find_runtime_cb(char *fname, void *cookie)
|
||||
{
|
||||
Array *rv = (Array *)cookie;
|
||||
if (fname != NULL) {
|
||||
ADD(*rv, STRING_OBJ(cstr_to_string((char *)fname)));
|
||||
ADD(*rv, STRING_OBJ(cstr_to_string(fname)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2266,7 +2266,7 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
|
||||
for (stl_hlrec_t *sp = hltab; sp->start != NULL; sp++) {
|
||||
Dictionary hl_info = ARRAY_DICT_INIT;
|
||||
|
||||
PUT(hl_info, "start", INTEGER_OBJ((char *)sp->start - buf));
|
||||
PUT(hl_info, "start", INTEGER_OBJ(sp->start - buf));
|
||||
|
||||
if (sp->userhl == 0) {
|
||||
grpname = get_default_stl_hl(wp, use_winbar);
|
||||
@@ -2281,7 +2281,7 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
|
||||
}
|
||||
PUT(result, "highlights", ARRAY_OBJ(hl_values));
|
||||
}
|
||||
PUT(result, "str", CSTR_TO_OBJ((char *)buf));
|
||||
PUT(result, "str", CSTR_TO_OBJ(buf));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user