Mercurial > vim
diff src/autocmd.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 | 3b2db762a509 |
children | eda4d65f232c |
line wrap: on
line diff
--- a/src/autocmd.c +++ b/src/autocmd.c @@ -1193,7 +1193,7 @@ do_autocmd_event( return FAIL; } - ap = (AutoPat *)alloc((unsigned)sizeof(AutoPat)); + ap = (AutoPat *)alloc(sizeof(AutoPat)); if (ap == NULL) return FAIL; ap->pat = vim_strnsave(pat, patlen); @@ -1242,7 +1242,7 @@ do_autocmd_event( prev_ac = &(ap->cmds); while ((ac = *prev_ac) != NULL) prev_ac = &ac->next; - ac = (AutoCmd *)alloc((unsigned)sizeof(AutoCmd)); + ac = (AutoCmd *)alloc(sizeof(AutoCmd)); if (ac == NULL) return FAIL; ac->cmd = vim_strsave(cmd); @@ -2303,8 +2303,8 @@ auto_next_pat( { name = event_nr2name(apc->event); s = _("%s Autocommands for \"%s\""); - sourcing_name = alloc((unsigned)(STRLEN(s) - + STRLEN(name) + ap->patlen + 1)); + sourcing_name = alloc(STRLEN(s) + + STRLEN(name) + ap->patlen + 1); if (sourcing_name != NULL) { sprintf((char *)sourcing_name, s,