aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/nvim/CMakeLists.txt6
-rw-r--r--src/nvim/api/autocmd.c4
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/cmdhist.c2
-rw-r--r--src/nvim/eval.c18
-rw-r--r--src/nvim/eval/funcs.c24
-rw-r--r--src/nvim/eval/typval.c12
-rw-r--r--src/nvim/eval/userfunc.c12
-rw-r--r--src/nvim/eval/vars.c4
-rw-r--r--src/nvim/eval/window.c2
-rw-r--r--src/nvim/ex_cmds.c10
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/getchar.c4
-rw-r--r--src/nvim/help.c2
-rw-r--r--src/nvim/keycodes.c2
-rw-r--r--src/nvim/lua/executor.c2
-rw-r--r--src/nvim/mapping.c21
-rw-r--r--src/nvim/marktree.c2
-rw-r--r--src/nvim/mbyte.c6
-rw-r--r--src/nvim/memfile.c2
-rw-r--r--src/nvim/option.c2
-rw-r--r--src/nvim/os/shell.c2
-rw-r--r--src/nvim/path.c8
-rw-r--r--src/nvim/quickfix.c8
-rw-r--r--src/nvim/runtime.c6
-rw-r--r--src/nvim/search.c10
-rw-r--r--src/nvim/shada.c2
-rw-r--r--src/nvim/sign.c14
-rw-r--r--src/nvim/statusline.c4
-rw-r--r--src/nvim/strings.c4
-rw-r--r--src/nvim/syntax.c2
31 files changed, 98 insertions, 103 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index f591477af7..d685e9feed 100755
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -146,11 +146,7 @@ if(HAS_DIAG_COLOR_FLAG)
endif()
endif()
-if($ENV{CI})
- option(CI_BUILD "CI, extra flags will be set" ON)
-else()
- option(CI_BUILD "CI, extra flags will be set" OFF)
-endif()
+option(CI_BUILD "CI, extra flags will be set" OFF)
if(CI_BUILD)
message(STATUS "CI build enabled")
if(MSVC)
diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c
index 620a295788..6a267103b4 100644
--- a/src/nvim/api/autocmd.c
+++ b/src/nvim/api/autocmd.c
@@ -608,7 +608,7 @@ void nvim_clear_autocmds(Dict(clear_autocmds) *opts, Error *err)
FOR_ALL_AUEVENTS(event) {
FOREACH_ITEM(patterns, pat_object, {
char *pat = pat_object.data.string.data;
- if (!clear_autocmd(event, (char *)pat, au_group, err)) {
+ if (!clear_autocmd(event, pat, au_group, err)) {
goto cleanup;
}
});
@@ -619,7 +619,7 @@ void nvim_clear_autocmds(Dict(clear_autocmds) *opts, Error *err)
FOREACH_ITEM(patterns, pat_object, {
char *pat = pat_object.data.string.data;
- if (!clear_autocmd(event_nr, (char *)pat, au_group, err)) {
+ if (!clear_autocmd(event_nr, pat, au_group, err)) {
goto cleanup;
}
});
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index d8282734d4..d1c93733c0 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -2231,7 +2231,7 @@ int buflist_findpat(const char *pattern, const char *pattern_end, bool unlisted,
// Repeat this for finding an unlisted buffer if there was no matching
// listed buffer.
- pat = file_pat_to_reg_pat((char *)pattern, (char *)pattern_end, NULL, false);
+ pat = file_pat_to_reg_pat(pattern, pattern_end, NULL, false);
if (pat == NULL) {
return -1;
}
diff --git a/src/nvim/cmdhist.c b/src/nvim/cmdhist.c
index c2928eb9c4..81b93e5304 100644
--- a/src/nvim/cmdhist.c
+++ b/src/nvim/cmdhist.c
@@ -622,7 +622,7 @@ void ex_history(exarg_T *eap)
}
histype1 = get_histtype(arg, (size_t)(end - arg), false);
if (histype1 == HIST_INVALID) {
- if (STRNICMP(arg, "all", end - (char *)arg) == 0) {
+ if (STRNICMP(arg, "all", end - arg) == 0) {
histype1 = 0;
histype2 = HIST_COUNT - 1;
} else {
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index f0b0e88b50..ff33fdeccb 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -984,7 +984,7 @@ void prepare_vimvar(int idx, typval_T *save_tv)
{
*save_tv = vimvars[idx].vv_tv;
if (vimvars[idx].vv_type == VAR_UNKNOWN) {
- hash_add(&vimvarht, (char *)vimvars[idx].vv_di.di_key);
+ hash_add(&vimvarht, vimvars[idx].vv_di.di_key);
}
}
@@ -997,7 +997,7 @@ void restore_vimvar(int idx, typval_T *save_tv)
return;
}
- hashitem_T *hi = hash_find(&vimvarht, (char *)vimvars[idx].vv_di.di_key);
+ hashitem_T *hi = hash_find(&vimvarht, vimvars[idx].vv_di.di_key);
if (HASHITEM_EMPTY(hi)) {
internal_error("restore_vimvar()");
} else {
@@ -1145,7 +1145,7 @@ void *call_func_retlist(const char *func, int argc, typval_T *argv)
typval_T rettv;
// All arguments are passed as strings, no conversion to number.
- if (call_vim_function((char *)func, argc, argv, &rettv) == FAIL) {
+ if (call_vim_function(func, argc, argv, &rettv) == FAIL) {
return NULL;
}
@@ -1763,7 +1763,7 @@ notify:
} else {
dictitem_T *di_ = lp->ll_di;
assert(di_->di_key != NULL);
- tv_dict_watcher_notify(dict, (char *)di_->di_key, lp->ll_tv, &oldtv);
+ tv_dict_watcher_notify(dict, di_->di_key, lp->ll_tv, &oldtv);
tv_clear(&oldtv);
}
}
@@ -1785,7 +1785,7 @@ void *eval_for_line(const char *arg, bool *errp, char **nextcmdp, int skip)
*errp = true; // Default: there is an error.
- expr = skip_var_list((char *)arg, &fi->fi_varcount, &fi->fi_semicolon);
+ expr = skip_var_list(arg, &fi->fi_varcount, &fi->fi_semicolon);
if (expr == NULL) {
return fi;
}
@@ -4828,7 +4828,7 @@ void filter_map(typval_T *argvars, typval_T *rettv, int map)
break;
}
- vimvars[VV_KEY].vv_str = xstrdup((char *)di->di_key);
+ vimvars[VV_KEY].vv_str = xstrdup(di->di_key);
int r = filter_map_one(&di->di_tv, expr, map, &rem);
tv_clear(&vimvars[VV_KEY].vv_tv);
if (r == FAIL || did_emsg) {
@@ -7631,10 +7631,10 @@ int store_session_globals(FILE *fd)
TV_DICT_ITER(&globvardict, this_var, {
if ((this_var->di_tv.v_type == VAR_NUMBER
|| this_var->di_tv.v_type == VAR_STRING)
- && var_flavour((char *)this_var->di_key) == VAR_FLAVOUR_SESSION) {
+ && var_flavour(this_var->di_key) == VAR_FLAVOUR_SESSION) {
// Escape special characters with a backslash. Turn a LF and
// CR into \n and \r.
- char *const p = (char *)vim_strsave_escaped(tv_get_string(&this_var->di_tv), "\\\"\n\r");
+ char *const p = vim_strsave_escaped(tv_get_string(&this_var->di_tv), "\\\"\n\r");
for (char *t = p; *t != NUL; t++) {
if (*t == '\n') {
*t = 'n';
@@ -7653,7 +7653,7 @@ int store_session_globals(FILE *fd)
}
xfree(p);
} else if (this_var->di_tv.v_type == VAR_FLOAT
- && var_flavour((char *)this_var->di_key) == VAR_FLAVOUR_SESSION) {
+ && var_flavour(this_var->di_key) == VAR_FLAVOUR_SESSION) {
float_T f = this_var->di_tv.vval.v_float;
int sign = ' ';
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index eaa66f6483..7f224f371c 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -956,7 +956,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
const size_t len = strlen(expr);
while (*p != NUL) {
- if (mb_strnicmp((char *)p, (char *)expr, len) == 0) {
+ if (mb_strnicmp(p, expr, len) == 0) {
n++;
p += len;
} else {
@@ -965,7 +965,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
}
} else {
char *next;
- while ((next = strstr((char *)p, (char *)expr)) != NULL) {
+ while ((next = strstr(p, expr)) != NULL) {
n++;
p = next + strlen(expr);
}
@@ -1064,17 +1064,17 @@ static void f_ctxpush(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
TV_LIST_ITER(argvars[0].vval.v_list, li, {
typval_T *tv_li = TV_LIST_ITEM_TV(li);
if (tv_li->v_type == VAR_STRING) {
- if (strequal((char *)tv_li->vval.v_string, "regs")) {
+ if (strequal(tv_li->vval.v_string, "regs")) {
types |= kCtxRegs;
- } else if (strequal((char *)tv_li->vval.v_string, "jumps")) {
+ } else if (strequal(tv_li->vval.v_string, "jumps")) {
types |= kCtxJumps;
- } else if (strequal((char *)tv_li->vval.v_string, "bufs")) {
+ } else if (strequal(tv_li->vval.v_string, "bufs")) {
types |= kCtxBufs;
- } else if (strequal((char *)tv_li->vval.v_string, "gvars")) {
+ } else if (strequal(tv_li->vval.v_string, "gvars")) {
types |= kCtxGVars;
- } else if (strequal((char *)tv_li->vval.v_string, "sfuncs")) {
+ } else if (strequal(tv_li->vval.v_string, "sfuncs")) {
types |= kCtxSFuncs;
- } else if (strequal((char *)tv_li->vval.v_string, "funcs")) {
+ } else if (strequal(tv_li->vval.v_string, "funcs")) {
types |= kCtxFuncs;
}
}
@@ -4953,7 +4953,7 @@ static void f_msgpackdump(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
char msgbuf[sizeof("msgpackdump() argument, index ") * 4 + NUMBUFLEN];
int idx = 0;
TV_LIST_ITER(list, li, {
- vim_snprintf(msgbuf, sizeof(msgbuf), (char *)msg, idx);
+ vim_snprintf(msgbuf, sizeof(msgbuf), msg, idx);
idx++;
if (encode_vim_to_msgpack(packer, TV_LIST_ITEM_TV(li), msgbuf) == FAIL) {
break;
@@ -6282,7 +6282,7 @@ static void f_reduce(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
argv[0] = *rettv;
argv[1] = *TV_LIST_ITEM_TV(li);
rettv->v_type = VAR_UNKNOWN;
- const int r = call_func((char *)func_name, -1, rettv, 2, argv, &funcexe);
+ const int r = call_func(func_name, -1, rettv, 2, argv, &funcexe);
tv_clear(&argv[0]);
if (r == FAIL || called_emsg != called_emsg_start) {
break;
@@ -6315,7 +6315,7 @@ static void f_reduce(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
argv[0] = *rettv;
argv[1].v_type = VAR_NUMBER;
argv[1].vval.v_number = tv_blob_get(b, i);
- if (call_func((char *)func_name, -1, rettv, 2, argv, &funcexe) == FAIL) {
+ if (call_func(func_name, -1, rettv, 2, argv, &funcexe) == FAIL) {
return;
}
}
@@ -8584,7 +8584,7 @@ static void f_synIDattr(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
}
rettv->v_type = VAR_STRING;
- rettv->vval.v_string = (char *)(p == NULL ? p : xstrdup(p));
+ rettv->vval.v_string = p == NULL ? NULL : xstrdup(p);
}
/// "synIDtrans(id)" function
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index bfac1ca864..3e67571053 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -897,7 +897,7 @@ void f_list2str(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
char buf[MB_MAXBYTES + 1];
TV_LIST_ITER_CONST(l, li, {
- buf[utf_char2bytes((int)tv_get_number(TV_LIST_ITEM_TV(li)), (char *)buf)] = NUL;
+ buf[utf_char2bytes((int)tv_get_number(TV_LIST_ITEM_TV(li)), buf)] = NUL;
ga_concat(&ga, buf);
});
ga_append(&ga, NUL);
@@ -1906,7 +1906,7 @@ dictitem_T *tv_dict_item_copy(dictitem_T *const di)
void tv_dict_item_remove(dict_T *const dict, dictitem_T *const item)
FUNC_ATTR_NONNULL_ALL
{
- hashitem_T *const hi = hash_find(&dict->dv_hashtab, (char *)item->di_key);
+ hashitem_T *const hi = hash_find(&dict->dv_hashtab, item->di_key);
if (HASHITEM_EMPTY(hi)) {
semsg(_(e_intern2), "tv_dict_item_remove()");
} else {
@@ -2111,9 +2111,9 @@ char **tv_dict_to_env(dict_T *denv)
TV_DICT_ITER(denv, var, {
const char *str = tv_get_string(&var->di_tv);
assert(str);
- size_t len = strlen((char *)var->di_key) + strlen(str) + strlen("=") + 1;
+ size_t len = strlen(var->di_key) + strlen(str) + strlen("=") + 1;
env[i] = xmalloc(len);
- snprintf(env[i], len, "%s=%s", (char *)var->di_key, str);
+ snprintf(env[i], len, "%s=%s", var->di_key, str);
i++;
});
@@ -2243,7 +2243,7 @@ int tv_dict_add(dict_T *const d, dictitem_T *const item)
if (tv_dict_wrong_func_name(d, &item->di_tv, item->di_key)) {
return FAIL;
}
- return hash_add(&d->dv_hashtab, (char *)item->di_key);
+ return hash_add(&d->dv_hashtab, item->di_key);
}
/// Add a list entry to dictionary
@@ -2944,7 +2944,7 @@ static void tv_dict_list(typval_T *const tv, typval_T *const rettv, const DictLi
switch (what) {
case kDictListKeys:
tv_item.v_type = VAR_STRING;
- tv_item.vval.v_string = xstrdup((char *)di->di_key);
+ tv_item.vval.v_string = xstrdup(di->di_key);
break;
case kDictListValues:
tv_copy(&di->di_tv, &tv_item);
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index 9c1e8230a3..f09da6b79b 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -758,7 +758,7 @@ static void funccal_unref(funccall_T *fc, ufunc_T *fp, bool force)
/// @return true if the entry was deleted, false if it wasn't found.
static bool func_remove(ufunc_T *fp)
{
- hashitem_T *hi = hash_find(&func_hashtab, (char *)UF2HIKEY(fp));
+ hashitem_T *hi = hash_find(&func_hashtab, UF2HIKEY(fp));
if (HASHITEM_EMPTY(hi)) {
return false;
}
@@ -905,7 +905,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
STRCPY(name, "self");
#endif
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
- hash_add(&fc->l_vars.dv_hashtab, (char *)v->di_key);
+ hash_add(&fc->l_vars.dv_hashtab, v->di_key);
v->di_tv.v_type = VAR_DICT;
v->di_tv.v_lock = VAR_UNLOCKED;
v->di_tv.vval.v_dict = selfdict;
@@ -931,7 +931,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
STRCPY(name, "000");
#endif
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
- hash_add(&fc->l_avars.dv_hashtab, (char *)v->di_key);
+ hash_add(&fc->l_avars.dv_hashtab, v->di_key);
v->di_tv.v_type = VAR_LIST;
v->di_tv.v_lock = VAR_FIXED;
v->di_tv.vval.v_list = &fc->l_varlist;
@@ -1009,9 +1009,9 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
// Named arguments can be accessed without the "a:" prefix in lambda
// expressions. Add to the l: dict.
tv_copy(&v->di_tv, &v->di_tv);
- hash_add(&fc->l_vars.dv_hashtab, (char *)v->di_key);
+ hash_add(&fc->l_vars.dv_hashtab, v->di_key);
} else {
- hash_add(&fc->l_avars.dv_hashtab, (char *)v->di_key);
+ hash_add(&fc->l_avars.dv_hashtab, v->di_key);
}
if (ai >= 0 && ai < MAX_FUNC_ARGS) {
@@ -1770,7 +1770,7 @@ char *trans_function_name(char **pp, bool skip, int flags, funcdict_T *fdp, part
semsg(_(e_invarg2), start);
}
} else {
- *pp = (char *)find_name_end((char *)start, NULL, NULL, FNE_INCL_BR);
+ *pp = (char *)find_name_end(start, NULL, NULL, FNE_INCL_BR);
}
goto theend;
}
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index 77b40fbf11..701f190a06 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -406,8 +406,8 @@ static const char *skip_var_one(const char *arg)
if (*arg == '@' && arg[1] != NUL) {
return arg + 2;
}
- return (char *)find_name_end(*arg == '$' || *arg == '&' ? arg + 1 : arg,
- NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
+ return find_name_end(*arg == '$' || *arg == '&' ? arg + 1 : arg,
+ NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
}
/// List variables for hashtab "ht" with prefix "prefix".
diff --git a/src/nvim/eval/window.c b/src/nvim/eval/window.c
index cf5727fa59..25de236d90 100644
--- a/src/nvim/eval/window.c
+++ b/src/nvim/eval/window.c
@@ -265,7 +265,7 @@ static int get_winnr(tabpage_T *tp, typval_T *argvar)
} else {
// Extract the window count (if specified). e.g. winnr('3j')
char *endp;
- long count = strtol((char *)arg, &endp, 10);
+ long count = strtol(arg, &endp, 10);
if (count <= 0) {
// if count is not specified, default to 1
count = 1;
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index a67a01bcea..a1b43113a6 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -150,7 +150,7 @@ void do_ascii(const exarg_T *const eap)
if (vim_isprintc_strict(c) && (c < ' ' || c > '~')) {
char buf3[7];
transchar_nonprint(curbuf, buf3, c);
- vim_snprintf(buf1, sizeof(buf1), " <%s>", (char *)buf3);
+ vim_snprintf(buf1, sizeof(buf1), " <%s>", buf3);
} else {
buf1[0] = NUL;
}
@@ -1361,12 +1361,12 @@ char *make_filter_cmd(char *cmd, char *itmp, char *otmp)
{
bool is_fish_shell =
#if defined(UNIX)
- strncmp((char *)invocation_path_tail(p_sh, NULL), "fish", 4) == 0;
+ strncmp(invocation_path_tail(p_sh, NULL), "fish", 4) == 0;
#else
false;
#endif
- bool is_pwsh = strncmp((char *)invocation_path_tail(p_sh, NULL), "pwsh", 4) == 0
- || strncmp((char *)invocation_path_tail(p_sh, NULL), "powershell",
+ bool is_pwsh = strncmp(invocation_path_tail(p_sh, NULL), "pwsh", 4) == 0
+ || strncmp(invocation_path_tail(p_sh, NULL), "powershell",
10) == 0;
size_t len = strlen(cmd) + 1; // At least enough space for cmd + NULL.
@@ -4288,7 +4288,7 @@ bool do_sub_msg(bool count_only)
"%" PRId64 " matches on %" PRId64 " lines", sub_nsubs)
: NGETTEXT("%" PRId64 " substitution on %" PRId64 " lines",
"%" PRId64 " substitutions on %" PRId64 " lines", sub_nsubs);
- vim_snprintf_add((char *)msg_buf, sizeof(msg_buf),
+ vim_snprintf_add(msg_buf, sizeof(msg_buf),
NGETTEXT(msg_single, msg_plural, sub_nlines),
(int64_t)sub_nsubs, (int64_t)sub_nlines);
if (msg(msg_buf)) {
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 4331de1d62..ba403e3dd9 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -295,7 +295,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
if (*p == '!') {
p = skipwhite(p + 1);
}
- while (ASCII_ISALPHA(*(p = skipwhite((char *)p)))) {
+ while (ASCII_ISALPHA(*(p = skipwhite(p)))) {
p++;
}
if (*p == NUL) {
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 9aed2630dd..69a371ccf9 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -2007,8 +2007,8 @@ static int handle_mapping(int *keylenp, const bool *timedout, int *mapdepth)
// Don't allow mapping the first byte(s) of a multi-byte char.
// Happens when mapping <M-a> and then changing 'encoding'.
// Beware that 0x80 is escaped.
- char *p1 = mp->m_keys;
- char *p2 = (char *)mb_unescape((const char **)&p1);
+ const char *p1 = mp->m_keys;
+ const char *p2 = mb_unescape(&p1);
if (p2 != NULL && MB_BYTE2LEN(tb_c1) > utfc_ptr2len(p2)) {
mlen = 0;
diff --git a/src/nvim/help.c b/src/nvim/help.c
index 10e9ecf281..633e9df244 100644
--- a/src/nvim/help.c
+++ b/src/nvim/help.c
@@ -1154,7 +1154,7 @@ static void do_helptags(char *dirname, bool add_help_tags, bool ignore_writeerr)
ext[1] = fname[5];
ext[2] = fname[6];
}
- helptags_one(dirname, (char *)ext, (char *)fname, add_help_tags, ignore_writeerr);
+ helptags_one(dirname, ext, fname, add_help_tags, ignore_writeerr);
}
ga_clear(&ga);
diff --git a/src/nvim/keycodes.c b/src/nvim/keycodes.c
index 8eec9014f7..3dcfb6376d 100644
--- a/src/nvim/keycodes.c
+++ b/src/nvim/keycodes.c
@@ -1002,7 +1002,7 @@ char *replace_termcodes(const char *const from, const size_t from_len, char **co
}
// skip multibyte char correctly
- for (i = utfc_ptr2len_len((char *)src, (int)(end - src) + 1); i > 0; i--) {
+ for (i = utfc_ptr2len_len(src, (int)(end - src) + 1); i > 0; i--) {
// If the character is K_SPECIAL, replace it with K_SPECIAL
// KS_SPECIAL KE_FILLER.
if (*src == (char)K_SPECIAL) {
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 82db8445df..3646fd876b 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1172,7 +1172,7 @@ int nlua_call(lua_State *lstate)
TRY_WRAP(&err, {
// call_func() retval is deceptive, ignore it. Instead we set `msg_list`
// (TRY_WRAP) to capture abort-causing non-exception errors.
- (void)call_func((char *)name, (int)name_len, &rettv, nargs, vim_args, &funcexe);
+ (void)call_func(name, (int)name_len, &rettv, nargs, vim_args, &funcexe);
});
if (!ERROR_SET(&err)) {
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c
index 68a3778a47..19a2aca75e 100644
--- a/src/nvim/mapping.c
+++ b/src/nvim/mapping.c
@@ -422,7 +422,7 @@ static int str_to_mapargs(const char *strargs, bool is_unmap, MapArguments *mapa
// {lhs_end} is a pointer to the "terminating whitespace" after {lhs}.
// Use that to initialize {rhs_start}.
- const char *rhs_start = skipwhite((char *)lhs_end);
+ const char *rhs_start = skipwhite(lhs_end);
// Given {lhs} might be larger than MAXMAPLEN before replace_termcodes
// (e.g. "<Space>" is longer than ' '), so first copy into a buffer.
@@ -449,7 +449,7 @@ static int str_to_mapargs(const char *strargs, bool is_unmap, MapArguments *mapa
/// @param args "rhs", "rhs_lua", "orig_rhs", "expr", "silent", "nowait", "replace_keycodes" and
/// and "desc" fields are used.
/// "rhs", "rhs_lua", "orig_rhs" fields are cleared if "simplified" is false.
-/// @param sid -1 to use current_sctx
+/// @param sid 0 to use current_sctx
static void map_add(buf_T *buf, mapblock_T **map_table, mapblock_T **abbr_table, const char *keys,
MapArguments *args, int noremap, int mode, bool is_abbr, scid_T sid,
linenr_T lnum, bool simplified)
@@ -482,7 +482,7 @@ static void map_add(buf_T *buf, mapblock_T **map_table, mapblock_T **abbr_table,
mp->m_simplified = simplified;
mp->m_expr = args->expr;
mp->m_replace_keycodes = args->replace_keycodes;
- if (sid >= 0) {
+ if (sid != 0) {
mp->m_script_ctx.sc_sid = sid;
mp->m_script_ctx.sc_lnum = lnum;
} else {
@@ -594,7 +594,7 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
const int first = vim_iswordp(lhs);
int last = first;
- p = (char *)lhs + utfc_ptr2len((char *)lhs);
+ p = lhs + utfc_ptr2len(lhs);
n = 1;
while (p < lhs + len) {
n++; // nr of (multi-byte) chars
@@ -733,8 +733,7 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
// we ignore trailing space when matching with
// the "lhs", since an abbreviation can't have
// trailing space.
- if (n != len && (!is_abbrev || round || n > len
- || *skipwhite((char *)lhs + n) != NUL)) {
+ if (n != len && (!is_abbrev || round || n > len || *skipwhite(lhs + n) != NUL)) {
mpp = &(mp->m_next);
continue;
}
@@ -857,9 +856,9 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
}
// Get here when adding a new entry to the maphash[] list or abbrlist.
- map_add(buf, map_table, abbr_table, (char *)lhs, args, noremap, mode, is_abbrev,
- -1, // sid
- 0, // lnum
+ map_add(buf, map_table, abbr_table, lhs, args, noremap, mode, is_abbrev,
+ 0, // sid
+ 0, // lnum
keyround1_simplified);
}
@@ -2645,10 +2644,10 @@ void modify_keymap(uint64_t channel_id, Buffer buffer, bool is_unmap, String mod
case 0:
break;
case 1:
- api_set_error(err, kErrorTypeException, (char *)e_invarg, 0);
+ api_set_error(err, kErrorTypeException, e_invarg, 0);
goto fail_and_free;
case 2:
- api_set_error(err, kErrorTypeException, (char *)e_nomap, 0);
+ api_set_error(err, kErrorTypeException, e_nomap, 0);
goto fail_and_free;
case 5:
api_set_error(err, kErrorTypeException,
diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c
index 7e900bafa2..f1285b39e7 100644
--- a/src/nvim/marktree.c
+++ b/src/nvim/marktree.c
@@ -1216,7 +1216,7 @@ void mt_inspect_node(MarkTree *b, garray_T *ga, mtnode_t *n, mtpos_t off)
for (int i = 0; i < n->n; i++) {
mtpos_t p = n->key[i].pos;
unrelative(off, &p);
- snprintf((char *)buf, sizeof(buf), "%d/%d", p.row, p.col);
+ snprintf(buf, sizeof(buf), "%d/%d", p.row, p.col);
ga_concat(ga, buf);
if (n->level) {
mt_inspect_node(b, ga, n->ptr[i + 1], p);
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index b44c3e52cb..ab787524a9 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -726,7 +726,7 @@ bool utf_composinglike(const char *p1, const char *p2)
if (!arabic_maycombine(c2)) {
return false;
}
- return arabic_combine(utf_ptr2char((char *)p1), c2);
+ return arabic_combine(utf_ptr2char(p1), c2);
}
/// Convert a UTF-8 string to a wide character
@@ -1312,10 +1312,10 @@ static int utf_strnicmp(const char *s1, const char *s2, size_t n1, size_t n2)
// to fold just one character to determine the result of comparison.
if (c1 != -1 && c2 == -1) {
- n1 = (size_t)utf_char2bytes(utf_fold(c1), (char *)buffer);
+ n1 = (size_t)utf_char2bytes(utf_fold(c1), buffer);
s1 = buffer;
} else if (c2 != -1 && c1 == -1) {
- n2 = (size_t)utf_char2bytes(utf_fold(c2), (char *)buffer);
+ n2 = (size_t)utf_char2bytes(utf_fold(c2), buffer);
s2 = buffer;
}
diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c
index 118b5d5886..51fa17384c 100644
--- a/src/nvim/memfile.c
+++ b/src/nvim/memfile.c
@@ -800,7 +800,7 @@ static bool mf_do_open(memfile_T *mfp, char *fname, int flags)
emsg(_("E300: Swap file already exists (symlink attack?)"));
} else {
// try to open the file
- mfp->mf_fd = MCH_OPEN_RW((char *)mfp->mf_fname, flags | O_NOFOLLOW);
+ mfp->mf_fd = MCH_OPEN_RW(mfp->mf_fname, flags | O_NOFOLLOW);
}
// If the file cannot be opened, use memory only
diff --git a/src/nvim/option.c b/src/nvim/option.c
index cf9612439b..386c6d88d9 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -5676,7 +5676,7 @@ static Dictionary vimoption2dict(vimoption_T *opt, int req_scope, buf_T *buf, wi
char *def_val = opt->def_val;
if (opt->flags & P_STRING) {
type = "string";
- def = CSTR_TO_OBJ(def_val ? (char *)def_val : "");
+ def = CSTR_TO_OBJ(def_val ? def_val : "");
} else if (opt->flags & P_NUM) {
type = "number";
def = INTEGER_OBJ((Integer)(intptr_t)def_val);
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 41b176eb41..52cab63989 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -144,7 +144,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
bool is_fish_shell =
#if defined(UNIX)
- strncmp((char *)invocation_path_tail(p_sh, NULL), "fish", 4) == 0;
+ strncmp(invocation_path_tail(p_sh, NULL), "fish", 4) == 0;
#else
false;
#endif
diff --git a/src/nvim/path.c b/src/nvim/path.c
index f320ecb342..368f3feb27 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -641,7 +641,7 @@ static size_t do_path_expand(garray_T *gap, const char *path, size_t wildoff, in
while (*path_end != NUL) {
// May ignore a wildcard that has a backslash before it; it will
// be removed by rem_backslash() or file_pat_to_reg_pat() below.
- if (path_end >= path + wildoff && rem_backslash((char *)path_end)) {
+ if (path_end >= path + wildoff && rem_backslash(path_end)) {
*p++ = *path_end++;
} else if (vim_ispathsep_nocolon(*path_end)) {
if (e != NULL) {
@@ -651,7 +651,7 @@ static size_t do_path_expand(garray_T *gap, const char *path, size_t wildoff, in
} else if (path_end >= path + wildoff
&& (vim_strchr("*?[{~$", (uint8_t)(*path_end)) != NULL
#ifndef MSWIN
- || (!p_fic && (flags & EW_ICASE) && mb_isalpha(utf_ptr2char((char *)path_end)))
+ || (!p_fic && (flags & EW_ICASE) && mb_isalpha(utf_ptr2char(path_end)))
#endif
)) { // NOLINT(whitespace/parens)
e = p;
@@ -727,9 +727,9 @@ static size_t do_path_expand(garray_T *gap, const char *path, size_t wildoff, in
char *dirpath = (*buf == NUL ? "." : buf);
if (os_file_is_readable(dirpath) && os_scandir(&dir, dirpath)) {
// Find all matching entries.
- char *name;
+ const char *name;
scandir_next_with_dots(NULL); // initialize
- while (!got_int && (name = (char *)scandir_next_with_dots(&dir)) != NULL) {
+ while (!got_int && (name = scandir_next_with_dots(&dir)) != NULL) {
if ((name[0] != '.'
|| starts_with_dot
|| ((flags & EW_DODOT)
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index e4b624179f..262d87ba61 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -531,7 +531,7 @@ static int efm_to_regpat(const char *efm, int len, efm_T *fmt_ptr, char *regpat)
}
}
if (idx < FMT_PATTERNS) {
- ptr = efmpat_to_regpat((char *)efmp, ptr, fmt_ptr, idx, round);
+ ptr = efmpat_to_regpat(efmp, ptr, fmt_ptr, idx, round);
if (ptr == NULL) {
return FAIL;
}
@@ -1241,7 +1241,7 @@ static char *qf_cmdtitle(char *cmd)
{
static char qftitle_str[IOSIZE];
- snprintf((char *)qftitle_str, IOSIZE, ":%s", cmd);
+ snprintf(qftitle_str, IOSIZE, ":%s", cmd);
return qftitle_str;
}
@@ -3281,7 +3281,7 @@ static void qf_msg(qf_info_T *qi, int which, char *lead)
int count = qi->qf_lists[which].qf_count;
char buf[IOSIZE];
- vim_snprintf((char *)buf, IOSIZE, _("%serror list %d of %d; %d errors "),
+ vim_snprintf(buf, IOSIZE, _("%serror list %d of %d; %d errors "),
lead,
which + 1,
qi->qf_listcount,
@@ -3506,7 +3506,7 @@ static char *qf_types(int c, int nr)
}
static char buf[20];
- snprintf((char *)buf, sizeof(buf), "%s %3d", p, nr);
+ snprintf(buf, sizeof(buf), "%s %3d", p, nr);
return buf;
}
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c
index 8d69e786c7..1e39b58543 100644
--- a/src/nvim/runtime.c
+++ b/src/nvim/runtime.c
@@ -1039,7 +1039,7 @@ static int load_pack_plugin(bool opt, char *fname)
do_cmdline_cmd("augroup filetypedetect");
vim_snprintf(pat, len, ftpat, ffname);
source_all_matches(pat);
- vim_snprintf((char *)pat, len, "%s/ftdetect/*.lua", ffname); // NOLINT
+ vim_snprintf(pat, len, "%s/ftdetect/*.lua", ffname); // NOLINT
source_all_matches(pat);
do_cmdline_cmd("augroup END");
}
@@ -1784,7 +1784,7 @@ static bool concat_continued_line(garray_T *const ga, const int init_growsize, c
size_t len)
FUNC_ATTR_NONNULL_ALL
{
- const char *const line = skipwhite_len((char *)p, len);
+ const char *const line = skipwhite_len(p, len);
len -= (size_t)(line - p);
// Skip lines starting with '\" ', concat lines starting with '\'
if (len >= 3 && strncmp(line, "\"\\ ", 3) == 0) {
@@ -1878,7 +1878,7 @@ static int source_using_linegetter(void *cookie, LineGetter fgetline, const char
if (save_sourcing_name == NULL) {
sname = (char *)traceback_name;
} else {
- snprintf((char *)sourcing_name_buf, sizeof(sourcing_name_buf),
+ snprintf(sourcing_name_buf, sizeof(sourcing_name_buf),
"%s called at %s:%" PRIdLINENR, traceback_name, save_sourcing_name,
save_sourcing_lnum);
sname = sourcing_name_buf;
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 0a94f3df44..694c4cad52 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -2233,10 +2233,10 @@ int check_linecomment(const char *line)
const char *p = line; // scan from start
// skip Lispish one-line comments
if (curbuf->b_p_lisp) {
- if (vim_strchr((char *)p, ';') != NULL) { // there may be comments
+ if (vim_strchr(p, ';') != NULL) { // there may be comments
bool in_str = false; // inside of string
- while ((p = strpbrk((char *)p, "\";")) != NULL) {
+ while ((p = strpbrk(p, "\";")) != NULL) {
if (*p == '"') {
if (in_str) {
if (*(p - 1) != '\\') { // skip escaped quote
@@ -2258,7 +2258,7 @@ int check_linecomment(const char *line)
p = NULL;
}
} else {
- while ((p = vim_strchr((char *)p, '/')) != NULL) {
+ while ((p = vim_strchr(p, '/')) != NULL) {
// Accept a double /, unless it's preceded with * and followed by *,
// because * / / * is an end and start of a C comment. Only
// accept the position if it is not inside a string.
@@ -3055,7 +3055,7 @@ static int fuzzy_match_recursive(const char *fuzpat, const char *str, uint32_t s
// Recursive call that "skips" this match
uint32_t recursiveMatches[MAX_FUZZY_MATCHES];
int recursiveScore = 0;
- const char *const next_char = (char *)str + utfc_ptr2len((char *)str);
+ const char *const next_char = str + utfc_ptr2len(str);
if (fuzzy_match_recursive(fuzpat, next_char, strIdx + 1, &recursiveScore, strBegin, strLen,
matches, recursiveMatches,
sizeof(recursiveMatches) / sizeof(recursiveMatches[0]), nextMatch,
@@ -4015,7 +4015,7 @@ search_line:
curwin->w_cursor.lnum = lnum;
check_cursor();
} else {
- if (!GETFILE_SUCCESS(getfile(0, (char *)files[depth].name, NULL, true,
+ if (!GETFILE_SUCCESS(getfile(0, files[depth].name, NULL, true,
files[depth].lnum, false))) {
break; // failed to jump to file
}
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 72e71ff46f..2d5eee7eec 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -4009,7 +4009,7 @@ static bool shada_removable(const char *name)
char part[MAXPATHL + 1];
bool retval = false;
- char *new_name = home_replace_save(NULL, (char *)name);
+ char *new_name = home_replace_save(NULL, name);
for (p = p_shada; *p;) {
(void)copy_option_part(&p, part, ARRAY_SIZE(part), ", ");
if (part[0] == 'r') {
diff --git a/src/nvim/sign.c b/src/nvim/sign.c
index 292e43a2dc..50a55ddd5c 100644
--- a/src/nvim/sign.c
+++ b/src/nvim/sign.c
@@ -100,7 +100,7 @@ static signgroup_T *sign_group_ref(const char *groupname)
signgroup_T *group;
hash = hash_hash(groupname);
- hi = hash_lookup(&sg_table, (char *)groupname, strlen(groupname), hash);
+ hi = hash_lookup(&sg_table, groupname, strlen(groupname), hash);
if (HASHITEM_EMPTY(hi)) {
// new group
group = xmalloc(offsetof(signgroup_T, sg_name) + strlen(groupname) + 1);
@@ -156,7 +156,7 @@ static int sign_group_get_next_signid(buf_T *buf, const char *groupname)
int found = false;
if (groupname != NULL) {
- hashitem_T *hi = hash_find(&sg_table, (char *)groupname);
+ hashitem_T *hi = hash_find(&sg_table, groupname);
if (HASHITEM_EMPTY(hi)) {
return id;
}
@@ -174,7 +174,7 @@ static int sign_group_get_next_signid(buf_T *buf, const char *groupname)
// Check whether this sign is already placed in the buffer
found = true;
FOR_ALL_SIGNS_IN_BUF(buf, sign) {
- if (id == sign->se_id && sign_in_group(sign, (char *)groupname)) {
+ if (id == sign->se_id && sign_in_group(sign, groupname)) {
found = false; // sign identifier is in use
break;
}
@@ -442,7 +442,7 @@ static linenr_T buf_change_sign_type(buf_T *buf, int markId, const char *group,
sign_entry_T *sign; // a sign in the signlist
FOR_ALL_SIGNS_IN_BUF(buf, sign) {
- if (sign->se_id == markId && sign_in_group(sign, (char *)group)) {
+ if (sign->se_id == markId && sign_in_group(sign, group)) {
sign->se_typenr = typenr;
sign->se_priority = prio;
sign_sort_by_prio_on_line(buf, sign);
@@ -2148,7 +2148,7 @@ static int sign_place_from_dict(typval_T *id_tv, typval_T *group_tv, typval_T *n
{
int sign_id = 0;
char *group = NULL;
- char *sign_name = NULL;
+ const char *sign_name = NULL;
buf_T *buf = NULL;
dictitem_T *di;
linenr_T lnum = 0;
@@ -2207,7 +2207,7 @@ static int sign_place_from_dict(typval_T *id_tv, typval_T *group_tv, typval_T *n
if (name_tv == NULL) {
goto cleanup;
}
- sign_name = (char *)tv_get_string_chk(name_tv);
+ sign_name = tv_get_string_chk(name_tv);
if (sign_name == NULL) {
goto cleanup;
}
@@ -2307,7 +2307,7 @@ static void sign_undefine_multiple(list_T *l, list_T *retlist)
TV_LIST_ITER_CONST(l, li, {
retval = -1;
name = (char *)tv_get_string_chk(TV_LIST_ITEM_TV(li));
- if (name != NULL && (sign_undefine_by_name((char *)name) == OK)) {
+ if (name != NULL && (sign_undefine_by_name(name) == OK)) {
retval = 0;
}
tv_list_append_number(retlist, retval);
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c
index 3c603ed033..6c698f45be 100644
--- a/src/nvim/statusline.c
+++ b/src/nvim/statusline.c
@@ -1443,8 +1443,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
// Store the current buffer number as a string variable
vim_snprintf(buf_tmp, sizeof(buf_tmp), "%d", curbuf->b_fnum);
set_internal_string_var("g:actual_curbuf", buf_tmp);
- vim_snprintf((char *)win_tmp, sizeof(win_tmp), "%d", curwin->handle);
- set_internal_string_var("g:actual_curwin", (char *)win_tmp);
+ vim_snprintf(win_tmp, sizeof(win_tmp), "%d", curwin->handle);
+ set_internal_string_var("g:actual_curwin", win_tmp);
buf_T *const save_curbuf = curbuf;
win_T *const save_curwin = curwin;
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index 4ef60f4ab8..14aa4ddc1a 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -946,10 +946,10 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, t
- str_arg);
}
if (fmt_spec == 'S') {
- char *p1;
+ const char *p1;
size_t i;
- for (i = 0, p1 = (char *)str_arg; *p1; p1 += utfc_ptr2len(p1)) {
+ for (i = 0, p1 = str_arg; *p1; p1 += utfc_ptr2len(p1)) {
size_t cell = (size_t)utf_ptr2cells(p1);
if (precision_specified && i + cell > precision) {
break;
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 60f374466e..5094f0cd6f 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -3674,7 +3674,7 @@ static void syn_clear_keyword(int id, hashtab_T *ht)
if (kp_next == NULL) {
hash_remove(ht, hi);
} else {
- hi->hi_key = (char *)KE2HIKEY(kp_next);
+ hi->hi_key = KE2HIKEY(kp_next);
}
} else {
kp_prev->ke_next = kp_next;