diff options
Diffstat (limited to 'src/nvim/eval')
-rw-r--r-- | src/nvim/eval/executor.c | 2 | ||||
-rw-r--r-- | src/nvim/eval/funcs.c | 37 | ||||
-rw-r--r-- | src/nvim/eval/userfunc.c | 18 |
3 files changed, 27 insertions, 30 deletions
diff --git a/src/nvim/eval/executor.c b/src/nvim/eval/executor.c index c08b7b1b2d..3e66150180 100644 --- a/src/nvim/eval/executor.c +++ b/src/nvim/eval/executor.c @@ -63,7 +63,7 @@ int eexe_mod_op(typval_T *const tv1, const typval_T *const tv2, const char *cons if (tv2->v_type == VAR_LIST) { break; } - if (vim_strchr((char_u *)"+-*/%", *op) != NULL) { + if (vim_strchr("+-*/%", *op) != NULL) { // nr += nr or nr -= nr, nr *= nr, nr /= nr, nr %= nr varnumber_T n = tv_get_number(tv1); if (tv2->v_type == VAR_FLOAT) { diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 04e9ffa570..68c2e37f22 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -485,9 +485,7 @@ static buf_T *find_buffer(typval_T *avar) * buffer, these don't use the full path. */ FOR_ALL_BUFFERS(bp) { if (bp->b_fname != NULL - && (path_with_url((char *)bp->b_fname) - || bt_nofile(bp) - ) + && (path_with_url(bp->b_fname) || bt_nofile(bp)) && STRCMP(bp->b_fname, avar->vval.v_string) == 0) { buf = bp; break; @@ -557,7 +555,7 @@ static void f_bufname(typval_T *argvars, typval_T *rettv, FunPtr fptr) buf = tv_get_buf_from_arg(&argvars[0]); } if (buf != NULL && buf->b_fname != NULL) { - rettv->vval.v_string = xstrdup((char *)buf->b_fname); + rettv->vval.v_string = xstrdup(buf->b_fname); } } @@ -638,7 +636,7 @@ buf_T *tv_get_buf(typval_T *tv, int curtab_only) { char_u *name = (char_u *)tv->vval.v_string; int save_magic; - char_u *save_cpo; + char *save_cpo; buf_T *buf; if (tv->v_type == VAR_NUMBER) { @@ -658,7 +656,7 @@ buf_T *tv_get_buf(typval_T *tv, int curtab_only) save_magic = p_magic; p_magic = TRUE; save_cpo = p_cpo; - p_cpo = (char_u *)""; + p_cpo = ""; buf = buflist_findnr(buflist_findpat(name, name + STRLEN(name), true, false, curtab_only)); @@ -2066,7 +2064,7 @@ static void f_exists(typval_T *argvars, typval_T *rettv, FunPtr fptr) n = true; } else { // Try expanding things like $VIM and ${HOME}. - char_u *const exp = expand_env_save((char_u *)p); + char *const exp = expand_env_save((char *)p); if (exp != NULL && *exp != '$') { n = true; } @@ -3390,7 +3388,7 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv, FunPtr fptr) FALLTHROUGH; case kCdScopeGlobal: if (globaldir) { // `globaldir` is not always set. - from = globaldir; + from = (char_u *)globaldir; break; } FALLTHROUGH; // In global directory, just need to get OS CWD. @@ -4147,8 +4145,7 @@ static void f_glob2regpat(typval_T *argvars, typval_T *rettv, FunPtr fptr) const char *const pat = tv_get_string_chk(&argvars[0]); // NULL on type error rettv->v_type = VAR_STRING; - rettv->vval.v_string = - (char *)((pat == NULL) ? NULL : file_pat_to_reg_pat((char_u *)pat, NULL, NULL, false)); + rettv->vval.v_string = (pat == NULL) ? NULL : file_pat_to_reg_pat(pat, NULL, NULL, false); } /// "has()" function @@ -5780,7 +5777,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv, long len = 0; char_u *expr = NULL; regmatch_T regmatch; - char_u *save_cpo; + char *save_cpo; long start = 0; long nth = 1; colnr_T startcol = 0; @@ -5792,7 +5789,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv, // Make 'cpoptions' empty, the 'l' flag should not be used here. save_cpo = p_cpo; - p_cpo = (char_u *)""; + p_cpo = ""; rettv->vval.v_number = -1; switch (type) { @@ -5873,7 +5870,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv, } } - regmatch.regprog = vim_regcomp((char_u *)pat, RE_MAGIC + RE_STRING); + regmatch.regprog = vim_regcomp((char *)pat, RE_MAGIC + RE_STRING); if (regmatch.regprog != NULL) { regmatch.rm_ic = p_ic; @@ -8306,7 +8303,7 @@ long do_searchpair(const char *spat, const char *mpat, const char *epat, int dir long time_limit) FUNC_ATTR_NONNULL_ARG(1, 2, 3) { - char_u *save_cpo; + char *save_cpo; char_u *pat, *pat2 = NULL, *pat3 = NULL; long retval = 0; pos_T pos; @@ -8322,7 +8319,7 @@ long do_searchpair(const char *spat, const char *mpat, const char *epat, int dir // Make 'cpoptions' empty, the 'l' flag should not be used here. save_cpo = p_cpo; - p_cpo = empty_option; + p_cpo = (char *)empty_option; // Set the time limit, if there is one. tm = profile_setlimit(time_limit); @@ -8446,11 +8443,11 @@ long do_searchpair(const char *spat, const char *mpat, const char *epat, int dir xfree(pat2); xfree(pat3); - if (p_cpo == empty_option) { + if ((char_u *)p_cpo == empty_option) { p_cpo = save_cpo; } else { // Darn, evaluating the {skip} expression changed the value. - free_string_option(save_cpo); + free_string_option((char_u *)save_cpo); } return retval; @@ -9741,7 +9738,7 @@ f_spellsuggest_return: static void f_split(typval_T *argvars, typval_T *rettv, FunPtr fptr) { - char_u *save_cpo; + char *save_cpo; int match; colnr_T col = 0; bool keepempty = false; @@ -9749,7 +9746,7 @@ static void f_split(typval_T *argvars, typval_T *rettv, FunPtr fptr) // Make 'cpoptions' empty, the 'l' flag should not be used here. save_cpo = p_cpo; - p_cpo = (char_u *)""; + p_cpo = ""; const char *str = tv_get_string(&argvars[0]); const char *pat = NULL; @@ -9774,7 +9771,7 @@ static void f_split(typval_T *argvars, typval_T *rettv, FunPtr fptr) } regmatch_T regmatch = { - .regprog = vim_regcomp((char_u *)pat, RE_MAGIC + RE_STRING), + .regprog = vim_regcomp((char *)pat, RE_MAGIC + RE_STRING), .startp = { NULL }, .endp = { NULL }, .rm_ic = false, diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index c6b6a8ead9..e5f48501f7 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -1536,7 +1536,7 @@ int call_func(const char *funcname, int len, typval_T *rettv, int argcount_in, t // Trigger FuncUndefined event, may load the function. if (fp == NULL - && apply_autocmds(EVENT_FUNCUNDEFINED, rfname, rfname, true, NULL) + && apply_autocmds(EVENT_FUNCUNDEFINED, (char *)rfname, (char *)rfname, true, NULL) && !aborting()) { // executed an autocommand, search for the function again fp = find_func(rfname); @@ -1967,7 +1967,7 @@ void ex_function(exarg_T *eap) c = *p; *p = NUL; - regmatch.regprog = vim_regcomp((char_u *)eap->arg + 1, RE_MAGIC); + regmatch.regprog = vim_regcomp(eap->arg + 1, RE_MAGIC); *p = c; if (regmatch.regprog != NULL) { regmatch.rm_ic = p_ic; @@ -2009,7 +2009,7 @@ void ex_function(exarg_T *eap) // g:func global function name, same as "func" p = (char_u *)eap->arg; name = trans_function_name(&p, eap->skip, TFN_NO_AUTOLOAD, &fudi, NULL); - paren = (vim_strchr(p, '(') != NULL); + paren = (vim_strchr((char *)p, '(') != NULL); if (name == NULL && (fudi.fd_dict == NULL || !paren) && !eap->skip) { /* * Return on an invalid expression in braces, unless the expression @@ -2090,8 +2090,8 @@ void ex_function(exarg_T *eap) goto ret_free; } // attempt to continue by skipping some text - if (vim_strchr(p, '(') != NULL) { - p = vim_strchr(p, '('); + if (vim_strchr((char *)p, '(') != NULL) { + p = (char_u *)vim_strchr((char *)p, '('); } } p = (char_u *)skipwhite((char *)p + 1); @@ -2207,7 +2207,7 @@ void ex_function(exarg_T *eap) if (line_arg != NULL) { // Use eap->arg, split up in parts by line breaks. theline = line_arg; - p = vim_strchr(theline, '\n'); + p = (char_u *)vim_strchr((char *)theline, '\n'); if (p == NULL) { line_arg += STRLEN(line_arg); } else { @@ -2369,7 +2369,7 @@ void ex_function(exarg_T *eap) // and ":let [a, b] =<< [trim] EOF" arg = (char_u *)skipwhite((char *)skiptowhite(p)); if (*arg == '[') { - arg = vim_strchr(arg, ']'); + arg = (char_u *)vim_strchr((char *)arg, ']'); } if (arg != NULL) { arg = (char_u *)skipwhite((char *)skiptowhite(arg)); @@ -2490,7 +2490,7 @@ void ex_function(exarg_T *eap) } if (fp == NULL) { - if (fudi.fd_dict == NULL && vim_strchr(name, AUTOLOAD_CHAR) != NULL) { + if (fudi.fd_dict == NULL && vim_strchr((char *)name, AUTOLOAD_CHAR) != NULL) { int slen, plen; char_u *scriptname; @@ -2498,7 +2498,7 @@ void ex_function(exarg_T *eap) int j = FAIL; if (sourcing_name != NULL) { scriptname = (char_u *)autoload_name((const char *)name, STRLEN(name)); - p = vim_strchr(scriptname, '/'); + p = (char_u *)vim_strchr((char *)scriptname, '/'); plen = (int)STRLEN(p); slen = (int)STRLEN(sourcing_name); if (slen > plen && FNAMECMP(p, |