[PATCH 17/34] ptrlist: use iterator for FOR_EACH_PTR()

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

 



---
 ptrlist.h | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/ptrlist.h b/ptrlist.h
index 728f29593..d8b96304f 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -163,15 +163,13 @@ static inline void ptr_cur_init(struct ptr_cur *cur, struct ptr_list *head)
 #define DO_FOR_EACH(head, ptr, __cur, CUR_ENTRY) do {					\
 	struct ptr_cur __cur;								\
 	CHECK_TYPE(head,ptr);								\
-	DO_INIT(__cur, head);								\
-	if (!__cur.h) break;								\
-	do {										\
-		for (__cur.n = 0; __cur.n < __cur.l->nr; __cur.n++) {			\
-			ptr = CUR_ENTRY(&__cur);					\
+	if (!head) break;								\
+	ptr_cur_beg(&__cur, (struct ptr_list *)head);					\
+	while (ptr_cur_next(&__cur)) {							\
+		ptr = CUR_ENTRY(&__cur);
 
 #define DO_END_FOR_EACH(ptr, __cur)							\
-		}									\
-	} while ((__cur.l = __cur.l->next) != __cur.h);					\
+	}										\
 } while (0)
 
 #define DO_FOR_EACH_REVERSE(head, ptr, __cur, CUR_ENTRY) do {				\
-- 
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