diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-28 23:08:19 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-28 23:08:19 +0200 |
commit | c799fe206e61f2e2c1231bc46cbe4bb354f3da69 (patch) | |
tree | 68b3d2a8bb82519e29fc95f317d2ee02b07f95fa /src/ex_cmds2.c | |
parent | b58a4b938c4bc7e0499700859bd7abba9acc5b11 (diff) | |
download | vim-git-c799fe206e61f2e2c1231bc46cbe4bb354f3da69.tar.gz |
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type castsv8.1.1414
Problem: Alloc() returning "char_u *" causes a lot of type casts.
Solution: Have it return "void *". (Mike Williams) Define ALLOC_ONE() to
check the simple allocations.
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r-- | src/ex_cmds2.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index a0c71694d..f6d9f331f 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -293,7 +293,7 @@ free_timer(timer_T *timer) timer_T * create_timer(long msec, int repeat) { - timer_T *timer = (timer_T *)alloc_clear(sizeof(timer_T)); + timer_T *timer = ALLOC_CLEAR_ONE(timer_T); long prev_id = last_timer_id; if (timer == NULL) @@ -444,7 +444,7 @@ check_due_timer(void) bevalexpr_due_set = FALSE; if (balloonEval == NULL) { - balloonEval = (BalloonEval *)alloc_clear(sizeof(BalloonEval)); + balloonEval = ALLOC_CLEAR_ONE(BalloonEval); balloonEvalForTerm = TRUE; } if (balloonEval != NULL) @@ -1312,7 +1312,7 @@ check_changed_any( if (bufcount == 0) return FALSE; - bufnrs = (int *)alloc(sizeof(int) * bufcount); + bufnrs = ALLOC_MULT(int, bufcount); if (bufnrs == NULL) return FALSE; @@ -1783,7 +1783,7 @@ ex_args(exarg_T *eap) */ if (ARGCOUNT > 0) { - char_u **items = (char_u **)alloc(sizeof(char_u *) * ARGCOUNT); + char_u **items = ALLOC_MULT(char_u *, ARGCOUNT); if (items != NULL) { @@ -2994,7 +2994,7 @@ ex_packadd(exarg_T *eap) continue; len = (int)STRLEN(plugpat) + (int)STRLEN(eap->arg) + 5; - pat = (char *)alloc(len); + pat = alloc(len); if (pat == NULL) return; vim_snprintf(pat, len, plugpat, round == 1 ? "start" : "opt", eap->arg); |