aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorii14 <59243201+ii14@users.noreply.github.com>2023-04-07 19:40:57 +0200
committerGitHub <noreply@github.com>2023-04-07 19:40:57 +0200
commit9408f2dcf7cade2631688300e9b58eed6bc5219a (patch)
tree152b8b6135f50619b1fb2a69719d71a180ea0792 /src
parent1d2a29f75ba7d094c8e7444c9b249a4a7211c93c (diff)
downloadrneovim-9408f2dcf7cade2631688300e9b58eed6bc5219a.tar.gz
rneovim-9408f2dcf7cade2631688300e9b58eed6bc5219a.tar.bz2
rneovim-9408f2dcf7cade2631688300e9b58eed6bc5219a.zip
refactor: remove redundant const char * casts
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/private/converter.c2
-rw-r--r--src/nvim/api/ui.c4
-rw-r--r--src/nvim/api/win_config.c9
-rw-r--r--src/nvim/arglist.c5
-rw-r--r--src/nvim/buffer.c7
-rw-r--r--src/nvim/channel.c14
-rw-r--r--src/nvim/charset.c2
-rw-r--r--src/nvim/cmdexpand.c68
-rw-r--r--src/nvim/edit.c2
-rw-r--r--src/nvim/eval.c51
-rw-r--r--src/nvim/eval/buffer.c9
-rw-r--r--src/nvim/eval/decode.c5
-rw-r--r--src/nvim/eval/encode.c6
-rw-r--r--src/nvim/eval/funcs.c27
-rw-r--r--src/nvim/eval/typval.c39
-rw-r--r--src/nvim/eval/userfunc.c30
-rw-r--r--src/nvim/eval/vars.c12
-rw-r--r--src/nvim/ex_cmds.c8
-rw-r--r--src/nvim/ex_cmds2.c2
-rw-r--r--src/nvim/ex_docmd.c4
-rw-r--r--src/nvim/ex_eval.c2
-rw-r--r--src/nvim/ex_getln.c14
-rw-r--r--src/nvim/file_search.c2
-rw-r--r--src/nvim/fileio.c27
-rw-r--r--src/nvim/fold.c2
-rw-r--r--src/nvim/help.c2
-rw-r--r--src/nvim/highlight_group.c38
-rw-r--r--src/nvim/insexpand.c6
-rw-r--r--src/nvim/lua/converter.c6
-rw-r--r--src/nvim/lua/executor.c12
-rw-r--r--src/nvim/mapping.c7
-rw-r--r--src/nvim/match.c10
-rw-r--r--src/nvim/memline.c4
-rw-r--r--src/nvim/message.c7
-rw-r--r--src/nvim/normal.c8
-rw-r--r--src/nvim/ops.c22
-rw-r--r--src/nvim/option.c12
-rw-r--r--src/nvim/os/env.c4
-rw-r--r--src/nvim/os/shell.c2
-rw-r--r--src/nvim/path.c2
-rw-r--r--src/nvim/quickfix.c40
-rw-r--r--src/nvim/regexp.c6
-rw-r--r--src/nvim/runtime.c22
-rw-r--r--src/nvim/search.c12
-rw-r--r--src/nvim/shada.c16
-rw-r--r--src/nvim/spell.c8
-rw-r--r--src/nvim/spellfile.c4
-rw-r--r--src/nvim/spellsuggest.c2
-rw-r--r--src/nvim/statusline.c2
-rw-r--r--src/nvim/syntax.c4
-rw-r--r--src/nvim/tag.c12
-rw-r--r--src/nvim/testing.c13
-rw-r--r--src/nvim/ui_client.c2
-rw-r--r--src/nvim/undo.c2
-rw-r--r--src/nvim/usercmd.c10
-rw-r--r--src/nvim/window.c2
56 files changed, 302 insertions, 350 deletions
diff --git a/src/nvim/api/private/converter.c b/src/nvim/api/private/converter.c
index 58ff552ab7..7d04d883f5 100644
--- a/src/nvim/api/private/converter.c
+++ b/src/nvim/api/private/converter.c
@@ -49,7 +49,7 @@ typedef struct {
#define TYPVAL_ENCODE_CONV_STRING(tv, str, len) \
do { \
const size_t len_ = (size_t)(len); \
- const char *const str_ = (const char *)(str); \
+ const char *const str_ = (str); \
assert(len_ == 0 || str_ != NULL); \
kvi_push(edata->stack, STRING_OBJ(cbuf_to_string((len_?str_:""), len_))); \
} while (0)
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index 5dd858a6a9..edf13b073c 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -843,7 +843,7 @@ void remote_ui_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Int
uint32_t csize = (repeat > 1) ? 3 : ((attrs[i] != last_hl) ? 2 : 1);
nelem++;
mpack_array(buf, csize);
- mpack_str(buf, (const char *)chunk[i]);
+ mpack_str(buf, chunk[i]);
if (csize >= 2) {
mpack_uint(buf, (uint32_t)attrs[i]);
if (csize >= 3) {
@@ -873,7 +873,7 @@ void remote_ui_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Int
for (int i = 0; i < endcol - startcol; i++) {
remote_ui_cursor_goto(ui, row, startcol + i);
remote_ui_highlight_set(ui, attrs[i]);
- remote_ui_put(ui, (const char *)chunk[i]);
+ remote_ui_put(ui, chunk[i]);
if (utf_ambiguous_width(utf_ptr2char((char *)chunk[i]))) {
data->client_col = -1; // force cursor update
}
diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c
index 0ffeac1bff..23bd5d2f48 100644
--- a/src/nvim/api/win_config.c
+++ b/src/nvim/api/win_config.c
@@ -275,13 +275,13 @@ Dictionary nvim_win_get_config(Window window, Error *err)
for (size_t i = 0; i < 8; i++) {
Array tuple = ARRAY_DICT_INIT;
- String s = cstrn_to_string((const char *)config->border_chars[i], sizeof(schar_T));
+ String s = cstrn_to_string(config->border_chars[i], sizeof(schar_T));
int hi_id = config->border_hl_ids[i];
char *hi_name = syn_id2name(hi_id);
if (hi_name[0]) {
ADD(tuple, STRING_OBJ(s));
- ADD(tuple, STRING_OBJ(cstr_to_string((const char *)hi_name)));
+ ADD(tuple, STRING_OBJ(cstr_to_string(hi_name)));
ADD(border, ARRAY_OBJ(tuple));
} else {
ADD(border, STRING_OBJ(s));
@@ -293,10 +293,9 @@ Dictionary nvim_win_get_config(Window window, Error *err)
VirtText title_datas = config->title_chunks;
for (size_t i = 0; i < title_datas.size; i++) {
Array tuple = ARRAY_DICT_INIT;
- ADD(tuple, CSTR_TO_OBJ((const char *)title_datas.items[i].text));
+ ADD(tuple, CSTR_TO_OBJ(title_datas.items[i].text));
if (title_datas.items[i].hl_id > 0) {
- ADD(tuple,
- STRING_OBJ(cstr_to_string((const char *)syn_id2name(title_datas.items[i].hl_id))));
+ ADD(tuple, STRING_OBJ(cstr_to_string(syn_id2name(title_datas.items[i].hl_id))));
}
ADD(titles, ARRAY_OBJ(tuple));
}
diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c
index 537b56353e..6735371576 100644
--- a/src/nvim/arglist.c
+++ b/src/nvim/arglist.c
@@ -1230,8 +1230,7 @@ static void get_arglist_as_rettv(aentry_T *arglist, int argcount, typval_T *rett
tv_list_alloc_ret(rettv, argcount);
if (arglist != NULL) {
for (int idx = 0; idx < argcount; idx++) {
- tv_list_append_string(rettv->vval.v_list,
- (const char *)alist_name(&arglist[idx]), -1);
+ tv_list_append_string(rettv->vval.v_list, alist_name(&arglist[idx]), -1);
}
}
}
@@ -1267,7 +1266,7 @@ void f_argv(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
rettv->vval.v_string = NULL;
int idx = (int)tv_get_number_chk(&argvars[0], NULL);
if (arglist != NULL && idx >= 0 && idx < argcount) {
- rettv->vval.v_string = xstrdup((const char *)alist_name(&arglist[idx]));
+ rettv->vval.v_string = xstrdup(alist_name(&arglist[idx]));
} else if (idx == -1) {
get_arglist_as_rettv(arglist, argcount, rettv);
}
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index fb674774c6..d8282734d4 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -268,7 +268,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags_arg)
int save_bin = curbuf->b_p_bin;
int perm;
- perm = os_getperm((const char *)curbuf->b_ffname);
+ perm = os_getperm(curbuf->b_ffname);
if (perm >= 0 && (0 || S_ISFIFO(perm)
|| S_ISSOCK(perm)
# ifdef OPEN_CHR_FILES
@@ -3309,8 +3309,7 @@ void maketitle(void)
SPACE_FOR_FNAME + 1);
buf_p += MIN(size, SPACE_FOR_FNAME);
} else {
- buf_p += transstr_buf((const char *)path_tail(curbuf->b_fname),
- -1, buf_p, SPACE_FOR_FNAME + 1, true);
+ buf_p += transstr_buf(path_tail(curbuf->b_fname), -1, buf_p, SPACE_FOR_FNAME + 1, true);
}
switch (bufIsChanged(curbuf)
@@ -3557,7 +3556,7 @@ void fname_expand(buf_T *buf, char **ffname, char **sfname)
#ifdef MSWIN
if (!buf->b_p_bin) {
// If the file name is a shortcut file, use the file it links to.
- char *rfname = os_resolve_shortcut((const char *)(*ffname));
+ char *rfname = os_resolve_shortcut(*ffname);
if (rfname != NULL) {
xfree(*ffname);
*ffname = rfname;
diff --git a/src/nvim/channel.c b/src/nvim/channel.c
index a7ec303a6c..820ce534e1 100644
--- a/src/nvim/channel.c
+++ b/src/nvim/channel.c
@@ -81,7 +81,7 @@ bool channel_close(uint64_t id, ChannelPart part, const char **error)
// allow double close, even though we can't say what parts was valid.
return true;
}
- *error = (const char *)e_invchan;
+ *error = e_invchan;
return false;
}
@@ -91,19 +91,19 @@ bool channel_close(uint64_t id, ChannelPart part, const char **error)
if (chan->is_rpc) {
rpc_close(chan);
} else if (part == kChannelPartRpc) {
- *error = (const char *)e_invstream;
+ *error = e_invstream;
return false;
}
} else if ((part == kChannelPartStdin || part == kChannelPartStdout)
&& chan->is_rpc) {
- *error = (const char *)e_invstreamrpc;
+ *error = e_invstreamrpc;
return false;
}
switch (chan->streamtype) {
case kChannelStreamSocket:
if (!close_main) {
- *error = (const char *)e_invstream;
+ *error = e_invstream;
return false;
}
stream_may_close(&chan->stream.socket);
@@ -134,14 +134,14 @@ bool channel_close(uint64_t id, ChannelPart part, const char **error)
stream_may_close(&chan->stream.stdio.out);
}
if (part == kChannelPartStderr) {
- *error = (const char *)e_invstream;
+ *error = e_invstream;
return false;
}
break;
case kChannelStreamStderr:
if (part != kChannelPartAll && part != kChannelPartStderr) {
- *error = (const char *)e_invstream;
+ *error = e_invstream;
return false;
}
if (!chan->stream.err.closed) {
@@ -156,7 +156,7 @@ bool channel_close(uint64_t id, ChannelPart part, const char **error)
case kChannelStreamInternal:
if (!close_main) {
- *error = (const char *)e_invstream;
+ *error = e_invstream;
return false;
}
if (chan->term) {
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 2be8ccc456..545002a197 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -389,7 +389,7 @@ size_t transstr_buf(const char *const s, const ssize_t slen, char *const buf, co
} else if (*p == TAB && !untab) {
*buf_p++ = *p++;
} else {
- const char *const tb = (const char *)transchar_byte((uint8_t)(*p++));
+ const char *const tb = transchar_byte((uint8_t)(*p++));
const size_t tb_len = strlen(tb);
if (buf_p + tb_len > buf_e) {
break; // Exceeded `buf` size.
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index bce28fa449..774e16f73d 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -959,7 +959,7 @@ static void showmatches_oneline(expand_T *xp, char **matches, int numMatches, in
msg_outtrans_attr(matches[j], HL_ATTR(HLF_D));
p = matches[j] + strlen(matches[j]) + 1;
msg_advance(maxlen + 1);
- msg_puts((const char *)p);
+ msg_puts(p);
msg_advance(maxlen + 3);
msg_outtrans_long_attr(p + 2, HL_ATTR(HLF_D));
break;
@@ -1438,7 +1438,7 @@ static const char *set_cmd_index(const char *cmd, exarg_T *eap, expand_T *xp, in
p = cmd + 1;
} else if (cmd[0] >= 'A' && cmd[0] <= 'Z') {
eap->cmd = (char *)cmd;
- p = (const char *)find_ucmd(eap, (char *)p, NULL, xp, complp);
+ p = find_ucmd(eap, (char *)p, NULL, xp, complp);
if (p == NULL) {
eap->cmdidx = CMD_SIZE; // Ambiguous user command.
}
@@ -1464,7 +1464,7 @@ static void set_context_for_wildcard_arg(exarg_T *eap, const char *arg, bool use
// Allow spaces within back-quotes to count as part of the argument
// being expanded.
xp->xp_pattern = skipwhite(arg);
- const char *p = (const char *)xp->xp_pattern;
+ const char *p = xp->xp_pattern;
while (*p != NUL) {
int c = utf_ptr2char(p);
if (c == '\\' && p[1] != NUL) {
@@ -1517,7 +1517,7 @@ static void set_context_for_wildcard_arg(exarg_T *eap, const char *arg, bool use
// Check for environment variable.
if (*xp->xp_pattern == '$') {
- for (p = (const char *)xp->xp_pattern + 1; *p != NUL; p++) {
+ for (p = xp->xp_pattern + 1; *p != NUL; p++) {
if (!vim_isIDc((uint8_t)(*p))) {
break;
}
@@ -1533,12 +1533,11 @@ static void set_context_for_wildcard_arg(exarg_T *eap, const char *arg, bool use
}
// Check for user names.
if (*xp->xp_pattern == '~') {
- for (p = (const char *)xp->xp_pattern + 1; *p != NUL && *p != '/'; p++) {}
+ for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; p++) {}
// Complete ~user only if it partially matches a user name.
// A full match ~user<Tab> will be replaced by user's home
// directory i.e. something like ~user<Tab> -> /home/user/
- if (*p == NUL && p > (const char *)xp->xp_pattern + 1
- && match_user(xp->xp_pattern + 1) >= 1) {
+ if (*p == NUL && p > xp->xp_pattern + 1 && match_user(xp->xp_pattern + 1) >= 1) {
xp->xp_context = EXPAND_USER;
xp->xp_pattern++;
}
@@ -1550,13 +1549,13 @@ static void set_context_for_wildcard_arg(exarg_T *eap, const char *arg, bool use
static const char *set_context_in_filter_cmd(expand_T *xp, const char *arg)
{
if (*arg != NUL) {
- arg = (const char *)skip_vimgrep_pat((char *)arg, NULL, NULL);
+ arg = skip_vimgrep_pat((char *)arg, NULL, NULL);
}
if (arg == NULL || *arg == NUL) {
xp->xp_context = EXPAND_NOTHING;
return NULL;
}
- return (const char *)skipwhite(arg);
+ return skipwhite(arg);
}
/// Set the completion context for the :match command. Returns a pointer to the
@@ -1566,13 +1565,13 @@ static const char *set_context_in_match_cmd(expand_T *xp, const char *arg)
if (*arg == NUL || !ends_excmd(*arg)) {
// also complete "None"
set_context_in_echohl_cmd(xp, arg);
- arg = (const char *)skipwhite(skiptowhite(arg));
+ arg = skipwhite(skiptowhite(arg));
if (*arg != NUL) {
xp->xp_context = EXPAND_NOTHING;
- arg = (const char *)skip_regexp((char *)arg + 1, (uint8_t)(*arg), magic_isset());
+ arg = skip_regexp((char *)arg + 1, (uint8_t)(*arg), magic_isset());
}
}
- return (const char *)find_nextcmd(arg);
+ return find_nextcmd(arg);
}
/// Returns a pointer to the next command after a :global or a :v command.
@@ -1605,7 +1604,7 @@ static const char *find_cmd_after_substitute_cmd(const char *arg)
if (delim) {
// Skip "from" part.
arg++;
- arg = (const char *)skip_regexp((char *)arg, delim, magic_isset());
+ arg = skip_regexp((char *)arg, delim, magic_isset());
if (arg[0] != NUL && arg[0] == delim) {
// Skip "to" part.
@@ -1637,7 +1636,7 @@ static const char *find_cmd_after_substitute_cmd(const char *arg)
static const char *find_cmd_after_isearch_cmd(expand_T *xp, const char *arg)
{
// Skip count.
- arg = (const char *)skipwhite(skipdigits(arg));
+ arg = skipwhite(skipdigits(arg));
if (*arg != '/') {
return NULL;
}
@@ -1649,7 +1648,7 @@ static const char *find_cmd_after_isearch_cmd(expand_T *xp, const char *arg)
}
}
if (*arg) {
- arg = (const char *)skipwhite(arg + 1);
+ arg = skipwhite(arg + 1);
// Check for trailing illegal characters.
if (*arg == NUL || strchr("|\"\n", *arg) == NULL) {
@@ -1666,7 +1665,7 @@ static const char *find_cmd_after_isearch_cmd(expand_T *xp, const char *arg)
static const char *set_context_in_unlet_cmd(expand_T *xp, const char *arg)
{
while ((xp->xp_pattern = strchr(arg, ' ')) != NULL) {
- arg = (const char *)xp->xp_pattern + 1;
+ arg = xp->xp_pattern + 1;
}
xp->xp_context = EXPAND_USER_VARS;
@@ -1683,7 +1682,7 @@ static const char *set_context_in_unlet_cmd(expand_T *xp, const char *arg)
/// Set the completion context for the :language command. Always returns NULL.
static const char *set_context_in_lang_cmd(expand_T *xp, const char *arg)
{
- const char *p = (const char *)skiptowhite(arg);
+ const char *p = skiptowhite(arg);
if (*p == NUL) {
xp->xp_context = EXPAND_LANGUAGE;
xp->xp_pattern = (char *)arg;
@@ -1876,11 +1875,11 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
case CMD_dsplit:
return find_cmd_after_isearch_cmd(xp, arg);
case CMD_autocmd:
- return (const char *)set_context_in_autocmd(xp, (char *)arg, false);
+ return set_context_in_autocmd(xp, (char *)arg, false);
case CMD_doautocmd:
case CMD_doautoall:
- return (const char *)set_context_in_autocmd(xp, (char *)arg, true);
+ return set_context_in_autocmd(xp, (char *)arg, true);
case CMD_set:
set_context_in_set_cmd(xp, (char *)arg, 0);
break;
@@ -1957,7 +1956,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
case CMD_bwipeout:
case CMD_bunload:
while ((xp->xp_pattern = strchr(arg, ' ')) != NULL) {
- arg = (const char *)xp->xp_pattern + 1;
+ arg = xp->xp_pattern + 1;
}
FALLTHROUGH;
case CMD_buffer:
@@ -2063,7 +2062,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
case CMD_tunmenu:
case CMD_popup:
case CMD_emenu:
- return (const char *)set_context_in_menu_cmd(xp, cmd, (char *)arg, forceit);
+ return set_context_in_menu_cmd(xp, cmd, (char *)arg, forceit);
case CMD_colorscheme:
xp->xp_context = EXPAND_COLORS;
@@ -2126,7 +2125,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
case CMD_argdelete:
while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) {
- arg = (const char *)(xp->xp_pattern + 1);
+ arg = (xp->xp_pattern + 1);
}
xp->xp_context = EXPAND_ARGLIST;
xp->xp_pattern = (char *)arg;
@@ -2186,7 +2185,7 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
}
// 3. skip over a range specifier of the form: addr [,addr] [;addr] ..
- cmd = (const char *)skip_range(cmd, &xp->xp_context);
+ cmd = skip_range(cmd, &xp->xp_context);
xp->xp_pattern = (char *)cmd;
if (*cmd == NUL) {
return NULL;
@@ -2218,7 +2217,7 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
ea.argt = excmd_get_argt(ea.cmdidx);
}
- const char *arg = (const char *)skipwhite(p);
+ const char *arg = skipwhite(p);
// Skip over ++argopt argument
if ((ea.argt & EX_ARGOPT) && *arg != NUL && strncmp(arg, "++", 2) == 0) {
@@ -2226,7 +2225,7 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
while (*p && !ascii_isspace(*p)) {
MB_PTR_ADV(p);
}
- arg = (const char *)skipwhite(p);
+ arg = skipwhite(p);
}
if (ea.cmdidx == CMD_write || ea.cmdidx == CMD_update) {
@@ -2234,7 +2233,7 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
if (*++arg == '>') {
arg++;
}
- arg = (const char *)skipwhite(arg);
+ arg = skipwhite(arg);
} else if (*arg == '!' && ea.cmdidx == CMD_write) { // :w !filter
arg++;
usefilter = true;
@@ -2253,14 +2252,14 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
while (*arg == *cmd) { // allow any number of '>' or '<'
arg++;
}
- arg = (const char *)skipwhite(arg);
+ arg = skipwhite(arg);
}
// Does command allow "+command"?
if ((ea.argt & EX_CMDARG) && !usefilter && *arg == '+') {
// Check if we're in the +command
p = arg + 1;
- arg = (const char *)skip_cmd_arg((char *)arg, false);
+ arg = skip_cmd_arg((char *)arg, false);
// Still touching the command after '+'?
if (*arg == NUL) {
@@ -2268,7 +2267,7 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
}
// Skip space(s) after +command to get to the real argument.
- arg = (const char *)skipwhite(arg);
+ arg = skipwhite(arg);
}
// Check for '|' to separate commands and '"' to start comments.
@@ -2344,7 +2343,7 @@ void set_cmd_context(expand_T *xp, char *str, int len, int col, int use_ccline)
old_char = str[col];
}
str[col] = NUL;
- const char *nextcomm = (const char *)str;
+ const char *nextcomm = str;
if (use_ccline && ccline->cmdfirstc == '=') {
// pass CMD_SIZE because there is no real command
@@ -2922,7 +2921,7 @@ static void expand_shellcmd_onedir(char *buf, char *s, size_t l, char *pat, char
// Check if this name was already found.
hash_T hash = hash_hash(name + l);
hashitem_T *hi =
- hash_lookup(ht, (const char *)(name + l), strlen(name + l), hash);
+ hash_lookup(ht, name + l, strlen(name + l), hash);
if (HASHITEM_EMPTY(hi)) {
// Remove the path that was prepended.
STRMOVE(name, name + l);
@@ -3166,7 +3165,7 @@ static int ExpandUserList(expand_T *xp, char ***matches, int *numMatches)
continue; // Skip non-string items and empty strings.
}
- GA_APPEND(char *, &ga, xstrdup((const char *)TV_LIST_ITEM_TV(li)->vval.v_string));
+ GA_APPEND(char *, &ga, xstrdup(TV_LIST_ITEM_TV(li)->vval.v_string));
});
tv_list_unref(retlist);
@@ -3195,7 +3194,7 @@ static int ExpandUserLua(expand_T *xp, int *num_file, char ***file)
continue; // Skip non-string items and empty strings.
}
- GA_APPEND(char *, &ga, xstrdup((const char *)TV_LIST_ITEM_TV(li)->vval.v_string));
+ GA_APPEND(char *, &ga, xstrdup(TV_LIST_ITEM_TV(li)->vval.v_string));
});
tv_list_unref(retlist);
@@ -3551,8 +3550,7 @@ theend:
tv_list_alloc_ret(rettv, xpc.xp_numfiles);
for (int i = 0; i < xpc.xp_numfiles; i++) {
- tv_list_append_string(rettv->vval.v_list, (const char *)xpc.xp_files[i],
- -1);
+ tv_list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1);
}
xfree(pat);
ExpandCleanup(&xpc);
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index c551ec2726..9e4457f793 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -2699,7 +2699,7 @@ int stuff_inserted(int c, long count, int no_esc)
}
do {
- stuffReadbuff((const char *)ptr);
+ stuffReadbuff(ptr);
// A trailing "0" is inserted as "<C-V>048", "^" as "<C-V>^".
if (last) {
stuffReadbuff(last == '0' ? "\026\060\064\070" : "\026^");
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 16a2dfa39b..f875e4f06f 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -1234,9 +1234,8 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
if (skip) {
// When skipping just find the end of the name.
- lp->ll_name = (const char *)name;
- return (char *)find_name_end(name, NULL, NULL,
- FNE_INCL_BR | fne_flags);
+ lp->ll_name = name;
+ return (char *)find_name_end(name, NULL, NULL, FNE_INCL_BR | fne_flags);
}
// Find the end of the name.
@@ -1269,8 +1268,8 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
lp->ll_name_len = strlen(lp->ll_name);
}
} else {
- lp->ll_name = (const char *)name;
- lp->ll_name_len = (size_t)((const char *)p - lp->ll_name);
+ lp->ll_name = name;
+ lp->ll_name_len = (size_t)(p - lp->ll_name);
}
// Without [idx] or .key we are done.
@@ -1417,7 +1416,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
}
lp->ll_list = NULL;
lp->ll_dict = lp->ll_tv->vval.v_dict;
- lp->ll_di = tv_dict_find(lp->ll_dict, (const char *)key, len);
+ lp->ll_di = tv_dict_find(lp->ll_dict, key, len);
// When assigning to a scope dictionary check that a function and
// variable name is valid (only variable name unless it is l: or
@@ -1434,8 +1433,8 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
}
wrong = ((lp->ll_dict->dv_scope == VAR_DEF_SCOPE
&& tv_is_func(*rettv)
- && var_wrong_func_name((const char *)key, lp->ll_di == NULL))
- || !valid_varname((const char *)key));
+ && var_wrong_func_name(key, lp->ll_di == NULL))
+ || !valid_varname(key));
if (len != -1) {
key[len] = prevval;
}
@@ -1728,7 +1727,7 @@ void set_var_lval(lval_T *lp, char *endp, typval_T *rettv, int copy, const bool
}
// Need to add an item to the Dictionary.
- di = tv_dict_item_alloc((const cha