Mercurial > vim
diff src/fileio.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 | 8b92f3fea477 |
children | d2deaaf21305 |
line wrap: on
line diff
--- a/src/fileio.c +++ b/src/fileio.c @@ -6203,7 +6203,7 @@ buf_modname( */ if (fname == NULL || *fname == NUL) { - retval = alloc((unsigned)(MAXPATHL + extlen + 3)); + retval = alloc(MAXPATHL + extlen + 3); if (retval == NULL) return NULL; if (mch_dirname(retval, MAXPATHL) == FAIL || @@ -6222,7 +6222,7 @@ buf_modname( else { fnamelen = (int)STRLEN(fname); - retval = alloc((unsigned)(fnamelen + extlen + 3)); + retval = alloc(fnamelen + extlen + 3); if (retval == NULL) return NULL; STRCPY(retval, fname); @@ -6894,8 +6894,8 @@ buf_check_timestamp( { if (!helpmesg) mesg2 = ""; - tbuf = (char *)alloc((unsigned)(STRLEN(path) + STRLEN(mesg) - + STRLEN(mesg2) + 2)); + tbuf = (char *)alloc(STRLEN(path) + STRLEN(mesg) + + STRLEN(mesg2) + 2); sprintf(tbuf, mesg, path); #ifdef FEAT_EVAL /* Set warningmsg here, before the unimportant and output-specific @@ -7391,7 +7391,7 @@ vim_settempdir(char_u *tempdir) { char_u *buf; - buf = alloc((unsigned)MAXPATHL + 2); + buf = alloc(MAXPATHL + 2); if (buf != NULL) { if (vim_FullName(tempdir, buf, MAXPATHL, FALSE) == FAIL)