[PATCH 23/34] ptrlist: use the iterator API for DO_DELETE_CURRENT()

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

 



---
 ptrlist.h | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/ptrlist.h b/ptrlist.h
index 26697c62f..c27a68f38 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -220,16 +220,22 @@ extern void split_ptr_list_head(struct ptr_list *);
 #define INSERT_CURRENT(new, ptr) \
 	DO_INSERT_CURRENT(new, ptr, __cur##ptr)
 
-#define DO_DELETE_CURRENT(ptr, __cur) do {						\
-	void **__this = __cur.l->list + __cur.n;					\
-	void **__last = __cur.l->list + __cur.l->nr - 1;				\
-	while (__this < __last) {							\
-		__this[0] = __this[1];							\
-		__this++;								\
-	}										\
-	*__this = (void *)0xf0f0f0f0;							\
-	__cur.l->nr--; __cur.n--;							\
-} while (0)
+static inline void ptr_cur_delete(struct ptr_cur *cur, void *ptr)
+{
+	void **this = cur->l->list + cur->n;
+	void **last = cur->l->list + cur->l->nr - 1;
+
+	while (this < last) {
+		this[0] = this[1];
+		this++;
+	}
+	*this = (void *)0xf0f0f0f0;
+	cur->l->nr--;
+	cur->n--;
+}
+
+#define DO_DELETE_CURRENT(ptr, __cur) \
+	ptr_cur_delete(&__cur, ptr)
 
 #define DELETE_CURRENT_PTR(ptr) \
 	DO_DELETE_CURRENT(ptr, __cur##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