comparison 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
comparison
equal deleted inserted replaced
16763:fccf84413b53 16764:ef00b6bc186b
1191 semsg(_("E680: <buffer=%d>: invalid buffer number "), 1191 semsg(_("E680: <buffer=%d>: invalid buffer number "),
1192 buflocal_nr); 1192 buflocal_nr);
1193 return FAIL; 1193 return FAIL;
1194 } 1194 }
1195 1195
1196 ap = (AutoPat *)alloc((unsigned)sizeof(AutoPat)); 1196 ap = (AutoPat *)alloc(sizeof(AutoPat));
1197 if (ap == NULL) 1197 if (ap == NULL)
1198 return FAIL; 1198 return FAIL;
1199 ap->pat = vim_strnsave(pat, patlen); 1199 ap->pat = vim_strnsave(pat, patlen);
1200 ap->patlen = patlen; 1200 ap->patlen = patlen;
1201 if (ap->pat == NULL) 1201 if (ap->pat == NULL)
1240 * Add the autocmd at the end of the AutoCmd list. 1240 * Add the autocmd at the end of the AutoCmd list.
1241 */ 1241 */
1242 prev_ac = &(ap->cmds); 1242 prev_ac = &(ap->cmds);
1243 while ((ac = *prev_ac) != NULL) 1243 while ((ac = *prev_ac) != NULL)
1244 prev_ac = &ac->next; 1244 prev_ac = &ac->next;
1245 ac = (AutoCmd *)alloc((unsigned)sizeof(AutoCmd)); 1245 ac = (AutoCmd *)alloc(sizeof(AutoCmd));
1246 if (ac == NULL) 1246 if (ac == NULL)
1247 return FAIL; 1247 return FAIL;
1248 ac->cmd = vim_strsave(cmd); 1248 ac->cmd = vim_strsave(cmd);
1249 #ifdef FEAT_EVAL 1249 #ifdef FEAT_EVAL
1250 ac->script_ctx = current_sctx; 1250 ac->script_ctx = current_sctx;
2301 apc->sfname, apc->tail, ap->allow_dirs)) 2301 apc->sfname, apc->tail, ap->allow_dirs))
2302 : ap->buflocal_nr == apc->arg_bufnr) 2302 : ap->buflocal_nr == apc->arg_bufnr)
2303 { 2303 {
2304 name = event_nr2name(apc->event); 2304 name = event_nr2name(apc->event);
2305 s = _("%s Autocommands for \"%s\""); 2305 s = _("%s Autocommands for \"%s\"");
2306 sourcing_name = alloc((unsigned)(STRLEN(s) 2306 sourcing_name = alloc(STRLEN(s)
2307 + STRLEN(name) + ap->patlen + 1)); 2307 + STRLEN(name) + ap->patlen + 1);
2308 if (sourcing_name != NULL) 2308 if (sourcing_name != NULL)
2309 { 2309 {
2310 sprintf((char *)sourcing_name, s, 2310 sprintf((char *)sourcing_name, s,
2311 (char *)name, (char *)ap->pat); 2311 (char *)name, (char *)ap->pat);
2312 if (p_verbose >= 8) 2312 if (p_verbose >= 8)