[PATCH 25/34] ptrlist: let delete_ptr_list() use the iterator API

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

 



---
 ptrlist.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/ptrlist.c b/ptrlist.c
index c532dbaac..95ff319db 100644
--- a/ptrlist.c
+++ b/ptrlist.c
@@ -150,15 +150,19 @@ void **__add_ptr_list(struct ptr_list **listp, void *ptr, unsigned long tag)
 
 int delete_ptr_list_entry(struct ptr_list **list, void *entry, int count)
 {
-	void *ptr;
+	struct ptr_cur cur;
 
-	FOR_EACH_PTR(*list, ptr) {
+	if (!ptr_cur_beg(&cur, *list))
+                goto out;
+
+	while (ptr_cur_next(&cur)) {
+		void *ptr = cur.l->list[cur.n];
 		if (ptr == entry) {
-			DELETE_CURRENT_PTR(ptr);
+			ptr_cur_delete(&cur, ptr);
 			if (!--count)
 				goto out;
 		}
-	} END_FOR_EACH_PTR(ptr);
+	}
 	assert(count <= 0);
 out:
 	pack_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