[PATCH 24/34] ptrlist: extract prt_cur_delete() from ptrlist.h

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

 



---
 ptrlist.c | 15 +++++++++++++++
 ptrlist.h | 15 +--------------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/ptrlist.c b/ptrlist.c
index c7d049616..c532dbaac 100644
--- a/ptrlist.c
+++ b/ptrlist.c
@@ -327,3 +327,18 @@ void ptr_cur_insert(struct ptr_cur *cur, void *new, void *ptr)
 	*this = new;
 	curl->nr++;
 }
+
+void ptr_cur_delete(struct ptr_cur *cur, void *ptr)
+{
+	struct ptr_list *curl = cur->l;
+	void **this = curl->list + cur->n;
+	void **last = curl->list + curl->nr - 1;
+
+	while (this < last) {
+		this[0] = this[1];
+		this++;
+	}
+	*this = (void *)0xf0f0f0f0;
+	curl->nr--;
+	cur->n--;
+}
diff --git a/ptrlist.h b/ptrlist.h
index c27a68f38..c1d53632d 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -56,6 +56,7 @@ int ptr_cur_next(struct ptr_cur *cur);
 int ptr_cur_end(struct ptr_cur *cur, struct ptr_list *head);
 int ptr_cur_prev(struct ptr_cur *cur);
 void ptr_cur_insert(struct ptr_cur *cur, void *new, void *ptr);
+void ptr_cur_delete(struct ptr_cur *cur, void *ptr);
 
 /*
  * Hey, who said that you can't do overloading in C?
@@ -220,20 +221,6 @@ extern void split_ptr_list_head(struct ptr_list *);
 #define INSERT_CURRENT(new, ptr) \
 	DO_INSERT_CURRENT(new, ptr, __cur##ptr)
 
-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)
 
-- 
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