linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 2/6] ptrlist: change TYPEOF() into PTRLIST_TYPE()
Date: Sat,  6 Mar 2021 11:05:48 +0100	[thread overview]
Message-ID: <20210306100552.33784-3-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20210306100552.33784-1-luc.vanoostenryck@gmail.com>

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(-)

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++;						\
-- 
2.30.0


  parent reply	other threads:[~2021-03-06 10:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-06 10:05 [PATCH 0/6] small changes to ptrlist API Luc Van Oostenryck
2021-03-06 10:05 ` [PATCH 1/6] ptrlist: ~fix TYPEOF() Luc Van Oostenryck
2021-03-06 16:19   ` Ramsay Jones
2021-03-06 10:05 ` Luc Van Oostenryck [this message]
2021-03-06 16:20   ` [PATCH 2/6] ptrlist: change TYPEOF() into PTRLIST_TYPE() Ramsay Jones
2021-03-06 10:05 ` [PATCH 3/6] ptrlist: add pop_ptr_list() Luc Van Oostenryck
2021-03-06 16:22   ` Ramsay Jones
2021-03-06 10:05 ` [PATCH 4/6] ptrlist: use ptr_list_nth() instead of linearize_ptr_list() Luc Van Oostenryck
2021-03-06 16:24   ` Ramsay Jones
2021-03-06 10:05 ` [PATCH 5/6] ptrlist: make linearize_ptr_list() generic Luc Van Oostenryck
2021-03-06 16:35   ` Ramsay Jones
2021-03-06 22:05     ` Luc Van Oostenryck
2021-03-06 10:05 ` [PATCH 6/6] ptrlist: change return value of linearize_ptr_list()/ptr_list_to_array() Luc Van Oostenryck
2021-03-06 16:43   ` Ramsay Jones
2021-03-06 17:46     ` Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210306100552.33784-3-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).