Message ID | 20210306100552.33784-3-luc.vanoostenryck@gmail.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | small changes to ptrlist API | expand |
On 06/03/2021 10:05, Luc Van Oostenryck wrote: > The name of the macro TYPEOF() is too generic and doesn't explain > that it only returns the type of the pointers stored in ptrlists. > > So, change he name to something more explicit: PTRLIST_TYPE(). s/change he/change the/ ATB, Ramsay Jones > > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> > --- > ptrlist.h | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/ptrlist.h b/ptrlist.h > index 41d9011c8716..3b952097545f 100644 > --- a/ptrlist.h > +++ b/ptrlist.h > @@ -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 PTRLIST_TYPE(head) __typeof__((head)->list[0]) > #define VRFY_PTR_LIST(head) (void)(sizeof((head)->list[0])) > > #define LIST_NODE_NR (13) > @@ -75,7 +75,7 @@ extern void __free_ptr_list(struct ptr_list **); > > #define ptr_list_nth(lst, nth) ({ \ > struct ptr_list* head = (struct ptr_list*)(lst); \ > - (__typeof__((lst)->list[0])) ptr_list_nth_entry(head, nth);\ > + (PTRLIST_TYPE(lst)) ptr_list_nth_entry(head, nth);\ > }) > > //////////////////////////////////////////////////////////////////////// > @@ -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; \ > + PTRLIST_TYPE(__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; \ > + PTRLIST_TYPE(__head) *__this = __list->list + __nr; \ > + PTRLIST_TYPE(__head) *__last = __list->list + __list->nr - 1; \ > while (__this < __last) { \ > __this[0] = __this[1]; \ > __this++; \ >
diff --git a/ptrlist.h b/ptrlist.h index 41d9011c8716..3b952097545f 100644 --- a/ptrlist.h +++ b/ptrlist.h @@ -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 PTRLIST_TYPE(head) __typeof__((head)->list[0]) #define VRFY_PTR_LIST(head) (void)(sizeof((head)->list[0])) #define LIST_NODE_NR (13) @@ -75,7 +75,7 @@ extern void __free_ptr_list(struct ptr_list **); #define ptr_list_nth(lst, nth) ({ \ struct ptr_list* head = (struct ptr_list*)(lst); \ - (__typeof__((lst)->list[0])) ptr_list_nth_entry(head, nth);\ + (PTRLIST_TYPE(lst)) ptr_list_nth_entry(head, nth);\ }) //////////////////////////////////////////////////////////////////////// @@ -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; \ + PTRLIST_TYPE(__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; \ + PTRLIST_TYPE(__head) *__this = __list->list + __nr; \ + PTRLIST_TYPE(__head) *__last = __list->list + __list->nr - 1; \ while (__this < __last) { \ __this[0] = __this[1]; \ __this++; \
The name of the macro TYPEOF() is too generic and doesn't explain that it only returns the type of the pointers stored in ptrlists. So, change he name to something more explicit: PTRLIST_TYPE(). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- ptrlist.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)