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/os_unix.c b/src/os_unix.c
index 803f944..01f5f59 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -3210,7 +3210,7 @@
* Ignore any errors.
*/
#if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
- signal_stack = (char *)alloc(SIGSTKSZ);
+ signal_stack = alloc(SIGSTKSZ);
init_signal_stack();
#endif
}
@@ -6843,7 +6843,7 @@
goto notfound;
}
*num_file = i;
- *file = (char_u **)alloc(sizeof(char_u *) * i);
+ *file = ALLOC_MULT(char_u *, i);
if (*file == NULL)
{
/* out of memory */
@@ -6938,7 +6938,7 @@
int i;
char_u *s;
- *file = (char_u **)alloc(num_pat * sizeof(char_u *));
+ *file = ALLOC_MULT(char_u *, num_pat);
if (*file == NULL)
return FAIL;
for (i = 0; i < num_pat; i++)