diff options
Diffstat (limited to 'src/nvim/eval/userfunc.c')
-rw-r--r-- | src/nvim/eval/userfunc.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 42f78422cb..7f0ac06f60 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -595,7 +595,7 @@ ufunc_T *find_func(const char_u *name) /// Takes care of script-local function names. static void cat_func_name(char_u *buf, ufunc_T *fp) { - if (fp->uf_name[0] == K_SPECIAL) { + if ((uint8_t)fp->uf_name[0] == K_SPECIAL) { STRCPY(buf, "<SNR>"); STRCAT(buf, fp->uf_name + 3); } else { @@ -610,7 +610,7 @@ static void add_nr_var(dict_T *dp, dictitem_T *v, char *name, varnumber_T nr) STRCPY(v->di_key, name); #endif v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; - hash_add(&dp->dv_hashtab, v->di_key); + hash_add(&dp->dv_hashtab, (char *)v->di_key); v->di_tv.v_type = VAR_NUMBER; v->di_tv.v_lock = VAR_FIXED; v->di_tv.vval.v_number = nr; @@ -906,7 +906,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, v->di_key); + hash_add(&fc->l_vars.dv_hashtab, (char *)v->di_key); v->di_tv.v_type = VAR_DICT; v->di_tv.v_lock = VAR_UNLOCKED; v->di_tv.vval.v_dict = selfdict; @@ -932,7 +932,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, v->di_key); + hash_add(&fc->l_avars.dv_hashtab, (char *)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; @@ -1010,9 +1010,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, v->di_key); + hash_add(&fc->l_vars.dv_hashtab, (char *)v->di_key); } else { - hash_add(&fc->l_avars.dv_hashtab, v->di_key); + hash_add(&fc->l_avars.dv_hashtab, (char *)v->di_key); } if (ai >= 0 && ai < MAX_FUNC_ARGS) { @@ -1318,7 +1318,7 @@ void free_all_functions(void) // Only free functions that are not refcounted, those are // supposed to be freed when no longer referenced. fp = HI2UF(hi); - if (func_name_refcount(fp->uf_name)) { + if (func_name_refcount((char_u *)fp->uf_name)) { skipped++; } else { used = func_hashtab.ht_used; @@ -1344,7 +1344,7 @@ void free_all_functions(void) // Only free functions that are not refcounted, those are // supposed to be freed when no longer referenced. fp = HI2UF(hi); - if (func_name_refcount(fp->uf_name)) { + if (func_name_refcount((char_u *)fp->uf_name)) { skipped++; } else { func_free(fp); @@ -1654,7 +1654,7 @@ theend: char_u *printable_func_name(ufunc_T *fp) { - return fp->uf_name_exp != NULL ? fp->uf_name_exp : fp->uf_name; + return fp->uf_name_exp != NULL ? fp->uf_name_exp : (char_u *)fp->uf_name; } /// List the head of the function: "name(arg1, arg2)". @@ -1970,7 +1970,7 @@ static void list_functions(regmatch_T *regmatch) if ((fp->uf_flags & FC_DEAD) == 0 && (regmatch == NULL ? (!message_filtered((char *)fp->uf_name) - && !func_name_refcount(fp->uf_name)) + && !func_name_refcount((char_u *)fp->uf_name)) : (!isdigit(*fp->uf_name) && vim_regexec(regmatch, (char *)fp->uf_name, 0)))) { list_func_head(fp, false, false); @@ -2590,7 +2590,7 @@ void ex_function(exarg_T *eap) set_ufunc_name(fp, name); if (overwrite) { hi = hash_find(&func_hashtab, name); - hi->hi_key = UF2HIKEY(fp); + hi->hi_key = (char *)UF2HIKEY(fp); } else if (hash_add(&func_hashtab, UF2HIKEY(fp)) == FAIL) { xfree(fp); goto erret; @@ -2718,7 +2718,7 @@ char *get_user_func_name(expand_T *xp, int idx) return ""; // don't show dict and lambda functions } - if (STRLEN(fp->uf_name) + 4 >= IOSIZE) { + if (strlen(fp->uf_name) + 4 >= IOSIZE) { return (char *)fp->uf_name; // Prevent overflow. } @@ -2802,7 +2802,7 @@ void ex_delfunction(exarg_T *eap) // it and the refcount is more than one, it should be kept. // A numbered function or lambda should be kept if the refcount is // one or more. - if (fp->uf_refcount > (func_name_refcount(fp->uf_name) ? 0 : 1)) { + if (fp->uf_refcount > (func_name_refcount((char_u *)fp->uf_name) ? 0 : 1)) { // Function is still referenced somewhere. Don't free it but // do remove it from the hashtable. if (func_remove(fp)) { @@ -3320,7 +3320,7 @@ void make_partial(dict_T *const selfdict, typval_T *const rettv) /// @return the name of the executed function. char_u *func_name(void *cookie) { - return ((funccall_T *)cookie)->func->uf_name; + return (char_u *)((funccall_T *)cookie)->func->uf_name; } /// @return the address holding the next breakpoint line for a funccall cookie. @@ -3579,7 +3579,7 @@ bool set_ref_in_functions(int copyID) if (!HASHITEM_EMPTY(hi)) { todo--; fp = HI2UF(hi); - if (!func_name_refcount(fp->uf_name) + if (!func_name_refcount((char_u *)fp->uf_name) && set_ref_in_func(NULL, fp, copyID)) { return true; } @@ -3648,5 +3648,5 @@ char_u *register_luafunc(LuaRef ref) hash_add(&func_hashtab, UF2HIKEY(fp)); // coverity[leaked_storage] - return fp->uf_name; + return (char_u *)fp->uf_name; } |