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.
diff --git a/src/popupmnu.c b/src/popupmnu.c
index e5811d3..9ebf6b7 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -1071,7 +1071,7 @@
* 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 @@
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 @@
return;
}
- array = (pumitem_T *)alloc_clear(sizeof(pumitem_T) * pum_size);
+ array = ALLOC_CLEAR_MULT(pumitem_T, pum_size);
if (array == NULL)
return;