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/sign.c b/src/sign.c
index 9766d4e..b89bea0 100644
--- a/src/sign.c
+++ b/src/sign.c
@@ -85,7 +85,7 @@
if (HASHITEM_EMPTY(hi))
{
// new group
- group = (signgroup_T *)alloc(sizeof(signgroup_T) + STRLEN(groupname));
+ group = alloc(sizeof(signgroup_T) + STRLEN(groupname));
if (group == NULL)
return NULL;
STRCPY(group->sg_name, groupname);
@@ -201,8 +201,7 @@
{
signlist_T *newsign;
- newsign = (signlist_T *)lalloc_id(sizeof(signlist_T), FALSE,
- aid_insert_sign);
+ newsign = lalloc_id(sizeof(signlist_T), FALSE, aid_insert_sign);
if (newsign != NULL)
{
newsign->id = id;
@@ -736,7 +735,7 @@
int start = next_sign_typenr;
// Allocate a new sign.
- sp = (sign_T *)alloc_clear_id(sizeof(sign_T), aid_sign_define_by_name);
+ sp = alloc_clear_id(sizeof(sign_T), aid_sign_define_by_name);
if (sp == NULL)
return NULL;