Mercurial > vim
diff src/sign.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 | fc58fee685e2 |
children | 1689b52cf297 |
line wrap: on
line diff
--- a/src/sign.c +++ b/src/sign.c @@ -85,7 +85,7 @@ sign_group_ref(char_u *groupname) 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 @@ insert_sign( { 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 @@ alloc_new_sign(char_u *name) 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;