diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-12-29 17:50:42 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-03-06 22:56:41 +0100 |
commit | c20e29a930e01aa884911791bce08bc447bb0239 (patch) | |
tree | df99802e4199e5a42d9fc883a14be34cf1eac997 | |
parent | eaceeafad39ade20c28b6634d30379763511c6e6 (diff) | |
download | sparse-c20e29a930e01aa884911791bce08bc447bb0239.tar.gz |
ptrlist: remove one pointer level from TYPEOF()
The macro TYPEOF() return the type of the addresses of the pointers
stored in the list. That's one level too much in general.
Change it to simply return the type of the stored pointers.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | ptrlist.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -12,7 +12,7 @@ /* Silly type-safety check ;) */ #define CHECK_TYPE(head,ptr) (void)(&(ptr) == &(head)->list[0]) -#define TYPEOF(head) __typeof__(&(head)->list[0]) +#define TYPEOF(head) __typeof__((head)->list[0]) #define VRFY_PTR_LIST(head) (void)(sizeof((head)->list[0])) #define LIST_NODE_NR (13) @@ -251,7 +251,7 @@ extern void __free_ptr_list(struct ptr_list **); extern void split_ptr_list_head(struct ptr_list *); #define DO_INSERT_CURRENT(new, __head, __list, __nr) do { \ - TYPEOF(__head) __this, __last; \ + TYPEOF(__head) *__this, *__last; \ if (__list->nr == LIST_NODE_NR) { \ split_ptr_list_head((struct ptr_list*)__list); \ if (__nr >= __list->nr) { \ @@ -270,8 +270,8 @@ extern void split_ptr_list_head(struct ptr_list *); } while (0) #define DO_DELETE_CURRENT(__head, __list, __nr) do { \ - TYPEOF(__head) __this = __list->list + __nr; \ - TYPEOF(__head) __last = __list->list + __list->nr - 1; \ + TYPEOF(__head) *__this = __list->list + __nr; \ + TYPEOF(__head) *__last = __list->list + __list->nr - 1; \ while (__this < __last) { \ __this[0] = __this[1]; \ __this++; \ |