Mercurial > vim
comparison src/list.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 | 041156ce1d22 |
comparison
equal
deleted
inserted
replaced
16824:1f6bb29738d2 | 16825:ce04ebdf26b8 |
---|---|
70 list_T * | 70 list_T * |
71 list_alloc(void) | 71 list_alloc(void) |
72 { | 72 { |
73 list_T *l; | 73 list_T *l; |
74 | 74 |
75 l = (list_T *)alloc_clear(sizeof(list_T)); | 75 l = ALLOC_CLEAR_ONE(list_T); |
76 if (l != NULL) | 76 if (l != NULL) |
77 { | 77 { |
78 /* Prepend the list to the list of lists for garbage collection. */ | 78 /* Prepend the list to the list of lists for garbage collection. */ |
79 if (first_list != NULL) | 79 if (first_list != NULL) |
80 first_list->lv_used_prev = l; | 80 first_list->lv_used_prev = l; |
242 * It is not initialized, don't forget to set v_lock. | 242 * It is not initialized, don't forget to set v_lock. |
243 */ | 243 */ |
244 listitem_T * | 244 listitem_T * |
245 listitem_alloc(void) | 245 listitem_alloc(void) |
246 { | 246 { |
247 return (listitem_T *)alloc(sizeof(listitem_T)); | 247 return ALLOC_ONE(listitem_T); |
248 } | 248 } |
249 | 249 |
250 /* | 250 /* |
251 * Free a list item. Also clears the value. Does not notify watchers. | 251 * Free a list item. Also clears the value. Does not notify watchers. |
252 */ | 252 */ |