Mercurial > vim
diff src/userfunc.c @ 16764:ef00b6bc186b v8.1.1384
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
commit https://github.com/vim/vim/commit/964b3746b9c81e65887e2ac9a335f181db2bb592
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri May 24 18:54:09 2019 +0200
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Problem: Using "int" for alloc() often results in compiler warnings.
Solution: Use "size_t" and remove type casts. Remove alloc_check(), Vim
only works with 32 bit ints anyway.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 24 May 2019 19:00:07 +0200 |
parents | 98393772bddd |
children | 695d9ef00b03 |
line wrap: on
line diff
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -557,7 +557,7 @@ fname_trans_sid(char_u *name, char_u *fn } else { - fname = alloc((unsigned)(i + STRLEN(name + llen) + 1)); + fname = alloc(i + STRLEN(name + llen) + 1); if (fname == NULL) *error = ERROR_OTHER; else @@ -978,7 +978,7 @@ call_user_func( /* need space for function name + ("function " + 3) or "[number]" */ len = (save_sourcing_name == NULL ? 0 : STRLEN(save_sourcing_name)) + STRLEN(fp->uf_name) + 20; - sourcing_name = alloc((unsigned)len); + sourcing_name = alloc(len); if (sourcing_name != NULL) { if (save_sourcing_name != NULL @@ -1932,7 +1932,7 @@ trans_function_name( } } - name = alloc((unsigned)(len + lead + 1)); + name = alloc(len + lead + 1); if (name != NULL) { if (lead > 0) @@ -2787,7 +2787,7 @@ func_dump_profile(FILE *fd) if (todo == 0) return; /* nothing to dump */ - sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T *) * todo)); + sorttab = (ufunc_T **)alloc(sizeof(ufunc_T *) * todo); for (hi = func_hashtab.ht_array; todo > 0; ++hi) {