Mercurial > vim
diff src/popupmnu.c @ 16825:ce04ebdf26b8 v8.1.1414
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
commit https://github.com/vim/vim/commit/c799fe206e61f2e2c1231bc46cbe4bb354f3da69
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 28 23:08:19 2019 +0200
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 28 May 2019 23:15:10 +0200 |
parents | 695d9ef00b03 |
children | d4c50bca8dbc |
line wrap: on
line diff
--- a/src/popupmnu.c +++ b/src/popupmnu.c @@ -1071,7 +1071,7 @@ split_message(char_u *mesg, pumitem_T ** * position. */ if (height > max_height) height = max_height; - *array = (pumitem_T *)alloc_clear(sizeof(pumitem_T) * height); + *array = ALLOC_CLEAR_MULT(pumitem_T, height); if (*array == NULL) goto failed; @@ -1164,8 +1164,7 @@ ui_post_balloon(char_u *mesg, list_T *li int idx; balloon_arraysize = list->lv_len; - balloon_array = (pumitem_T *)alloc_clear( - sizeof(pumitem_T) * list->lv_len); + balloon_array = ALLOC_CLEAR_MULT(pumitem_T, list->lv_len); if (balloon_array == NULL) return; for (idx = 0, li = list->lv_first; li != NULL; li = li->li_next, ++idx) @@ -1271,7 +1270,7 @@ pum_show_popupmenu(vimmenu_T *menu) return; } - array = (pumitem_T *)alloc_clear(sizeof(pumitem_T) * pum_size); + array = ALLOC_CLEAR_MULT(pumitem_T, pum_size); if (array == NULL) return;