[PATCH 32/34] ptrlist: tag/notag common case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 ptrlist.h | 43 +++++++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 22 deletions(-)

diff --git a/ptrlist.h b/ptrlist.h
index 1a0d7225c..1796f8466 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -84,10 +84,9 @@ static inline void *ptr_cur_entry(const struct ptr_cur *cur)
 	return __ptr_entry(cur->l, cur->n);
 }
 
-#define PTR_ENTRY_NOTAG(h,i)	__ptr_entry(h, i)
 #define __PTR_STRIP_TAG(ptr)	(void *)(~3UL & (unsigned long)(ptr))
 #define __PTR_KEEP_TAG(ptr)	(ptr)
-#define PTR_ENTRY(h,i)		__PTR_STRIP_TAG(PTR_ENTRY_NOTAG(h,i))
+#define PTR_ENTRY(h,i)		__PTR_STRIP_TAG(__ptr_entry(h,i))
 #define CUR_ENTRY_NOTAG(cur)	ptr_cur_entry(cur)
 #define CUR_ENTRY(cur)		__PTR_STRIP_TAG(CUR_ENTRY_NOTAG(cur))
 
@@ -114,81 +113,81 @@ static inline void *last_ptr_list(struct ptr_list *list)
 	return __PTR_STRIP_TAG(ptr_cur_entry(&cur));
 }
 
-#define DO_PREPARE(head, ptr, __cur, CUR_ENTRY)						\
+#define DO_PREPARE(head, ptr, __cur)						\
 do {										\
 		struct ptr_cur __cur;							\
 		CHECK_TYPE(head,ptr);							\
 		if (!ptr_cur_beg(&__cur, (struct ptr_list *)head) ||			\
 		    !ptr_cur_next(&__cur)) ptr = NULL;					\
-		else ptr = CUR_ENTRY(&__cur);
+		else ptr = ptr_cur_entry(&__cur);
 
-#define DO_NEXT(ptr, __cur, CUR_ENTRY)							\
+#define DO_NEXT(ptr, __cur)							\
 	if (ptr) {									\
 		if (ptr_cur_next(&__cur))						\
-			ptr = CUR_ENTRY(&__cur);					\
+			ptr = ptr_cur_entry(&__cur);					\
 		else									\
 			ptr = NULL;							\
 	}
 
-#define DO_RESET(ptr, __cur, CUR_ENTRY)						\
+#define DO_RESET(ptr, __cur)								\
 	if (!ptr_cur_beg(&__cur, (struct ptr_list *)head) ||				\
 	    !ptr_cur_next(&__cur)) ptr = NULL;						\
-	else ptr = CUR_ENTRY(&__cur);
+	else ptr = ptr_cur_entry(&__cur);
 
 #define DO_FINISH(ptr, __cur)								\
 		(void)(__cur.n); /* Sanity-check nesting */				\
 	} while (0)
 
 #define PREPARE_PTR_LIST(head, ptr) \
-	DO_PREPARE(head, ptr, __cur##ptr, CUR_ENTRY)
+	DO_PREPARE(head, ptr, __cur##ptr)
 
 #define NEXT_PTR_LIST(ptr) \
-	DO_NEXT(ptr, __cur##ptr, CUR_ENTRY)
+	DO_NEXT(ptr, __cur##ptr)
 
 #define RESET_PTR_LIST(ptr) \
-	DO_RESET(ptr, __cur##ptr, CUR_ENTRY)
+	DO_RESET(ptr, __cur##ptr)
 
 #define FINISH_PTR_LIST(ptr) \
 	DO_FINISH(ptr, __cur##ptr)
 
-#define DO_FOR_EACH(head, ptr, __cur, CUR_ENTRY) do {					\
+#define DO_FOR_EACH(head, ptr, __cur) do {						\
 	struct ptr_cur __cur;								\
 	CHECK_TYPE(head,ptr);								\
 	if (!head) break;								\
 	ptr_cur_beg(&__cur, (struct ptr_list *)head);					\
 	while (ptr_cur_next(&__cur)) {							\
-		ptr = CUR_ENTRY(&__cur);
+		ptr = ptr_cur_entry(&__cur);
 
 #define DO_END_FOR_EACH(ptr, __cur)							\
 	}										\
 } while (0)
 
-#define DO_FOR_EACH_REVERSE(head, ptr, __cur, CUR_ENTRY) do {				\
+#define DO_FOR_EACH_REVERSE(head, ptr, __cur) do {					\
 	struct ptr_cur __cur;								\
 	CHECK_TYPE(head,ptr);								\
 	if (!head) break;								\
 	ptr_cur_end(&__cur, (struct ptr_list *)head);					\
 	while (ptr_cur_prev(&__cur)) {							\
-		ptr = CUR_ENTRY(&__cur);
+		ptr = ptr_cur_entry(&__cur);
 
 #define DO_END_FOR_EACH_REVERSE(ptr, __cur)						\
 	}										\
 } while (0)
 
-#define DO_REVERSE(ptr, __cur, new, __newcur, CUR_ENTRY) do {				\
+#define DO_REVERSE(ptr, __cur, new, __newcur) do {					\
 	struct ptr_cur __newcur = __cur;						\
 	while (ptr_cur_prev(&__newcur)) {						\
-		new = CUR_ENTRY(&__newcur);
+		new = ptr_cur_entry(&__newcur);
 
 #define RECURSE_PTR_REVERSE(ptr, new)							\
 	DO_REVERSE(ptr, __cur##ptr,							\
-		   new, __cur##new, CUR_ENTRY)
+		   new, __cur##new)
 
 #define DO_THIS_ADDRESS(ptr, __cur)							\
 	((__typeof__(&(ptr))) (__cur.l->list + __cur.n))
 
 #define FOR_EACH_PTR(head, ptr) \
-	DO_FOR_EACH(head, ptr, __cur##ptr, CUR_ENTRY)
+	DO_FOR_EACH(head, ptr, __cur##ptr)
 
 #define FOR_EACH_TAGGED_PTR(head, ptr) \
 	FOR_EACH_PTR(head, ptr) \
@@ -198,18 +197,18 @@ do {										\
 	DO_END_FOR_EACH(ptr, __cur##ptr)
 
 #define FOR_EACH_PTR_NOTAG(head, ptr) \
-	DO_FOR_EACH(head, ptr, __cur##ptr, CUR_ENTRY_NOTAG)
+	FOR_EACH_PTR(head, ptr)
 
 #define END_FOR_EACH_PTR_NOTAG(ptr) END_FOR_EACH_PTR(ptr)
 
 #define FOR_EACH_PTR_REVERSE(head, ptr) \
-	DO_FOR_EACH_REVERSE(head, ptr, __cur##ptr, CUR_ENTRY)
+	DO_FOR_EACH_REVERSE(head, ptr, __cur##ptr)
 
 #define END_FOR_EACH_PTR_REVERSE(ptr) \
 	DO_END_FOR_EACH_REVERSE(ptr, __cur##ptr)
 
 #define FOR_EACH_PTR_REVERSE_NOTAG(head, ptr) \
-	DO_FOR_EACH_REVERSE(head, ptr, __cur##ptr, CUR_ENTRY_NOTAG)
+	FOR_EACH_REVERSE(head, ptr)
 
 #define END_FOR_EACH_PTR_REVERSE_NOTAG(ptr) END_FOR_EACH_PTR_REVERSE(ptr)
 
-- 
2.13.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux