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_getln.c | |
parent | b58a4b938c4bc7e0499700859bd7abba9acc5b11 (diff) |
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_getln.c')
-rw-r--r-- | src/ex_getln.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 80f1855ad3..c6d22e5fc6 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -5294,7 +5294,7 @@ ExpandGeneric( if (count == 0) return OK; *num_file = count; - *file = (char_u **)alloc(count * sizeof(char_u *)); + *file = ALLOC_MULT(char_u *, count); if (*file == NULL) { *file = (char_u **)""; @@ -5914,7 +5914,7 @@ init_history(void) { if (newlen) { - temp = (histentry_T *)alloc(newlen * sizeof(histentry_T)); + temp = ALLOC_MULT(histentry_T, newlen); if (temp == NULL) /* out of memory! */ { if (type == 0) /* first one: just keep the old length */ @@ -6653,8 +6653,7 @@ prepare_viminfo_history(int asklen, int writing) if (len <= 0) viminfo_history[type] = NULL; else - viminfo_history[type] = (histentry_T *)lalloc( - len * sizeof(histentry_T), FALSE); + viminfo_history[type] = LALLOC_MULT(histentry_T, len); if (viminfo_history[type] == NULL) len = 0; viminfo_hislen[type] = len; @@ -6873,8 +6872,8 @@ merge_history(int type) /* Make one long list with all entries. */ max_len = hislen + viminfo_hisidx[type]; - tot_hist = (histentry_T **)alloc(max_len * (int)sizeof(histentry_T *)); - new_hist = (histentry_T *)alloc(hislen * (int)sizeof(histentry_T)); + tot_hist = ALLOC_MULT(histentry_T *, max_len); + new_hist = ALLOC_MULT(histentry_T, hislen ); if (tot_hist == NULL || new_hist == NULL) { vim_free(tot_hist); |