[PATCH 08/34] ptrlist: let first_ptr_list() use the iterator API

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

 



---
 ptrlist.h | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/ptrlist.h b/ptrlist.h
index ff38538cb..b46967c58 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -86,19 +86,16 @@ static inline void *ptr_cur_entry(const struct ptr_cur *cur)
 #define __PTR_KEEP_TAG(ptr)	(ptr)
 #define PTR_ENTRY(h,i)		__PTR_STRIP_TAG(PTR_ENTRY_NOTAG(h,i))
 
+
 static inline void *first_ptr_list(struct ptr_list *list)
 {
-	struct ptr_list *head = list;
+	struct ptr_cur cur;
 
-	if (!list)
+	if (!ptr_cur_beg(&cur, list))
 		return NULL;
-
-	while (list->nr == 0) {
-		list = list->next;
-		if (list == head)
-			return NULL;
-	}
-	return PTR_ENTRY(list, 0);
+	if (!ptr_cur_next(&cur))
+		return NULL;
+	return __PTR_STRIP_TAG(ptr_cur_entry(&cur));
 }
 
 static inline void *last_ptr_list(struct ptr_list *list)
-- 
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