[PATCH 22/34] ptrlist: simplify ptr_cur_insert()

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

 



---
 ptrlist.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/ptrlist.c b/ptrlist.c
index 03a93db03..c7d049616 100644
--- a/ptrlist.c
+++ b/ptrlist.c
@@ -308,21 +308,22 @@ int ptr_cur_end(struct ptr_cur *cur, struct ptr_list *head)
 
 void ptr_cur_insert(struct ptr_cur *cur, void *new, void *ptr)
 {
+	struct ptr_list *curl = cur->l;
 	void **this, **last;
 
-	if (cur->l->nr == LIST_NODE_NR) {
-		split_ptr_list_head(cur->l);
-		if (cur->n >= cur->l->nr) {
-			cur->n -= cur->l->nr;
-			cur->l = cur->l->next;
+	if (curl->nr == LIST_NODE_NR) {
+		split_ptr_list_head(curl);
+		if (cur->n >= curl->nr) {
+			cur->n -= curl->nr;
+			curl = curl->next;
 		}
 	}
-	this = cur->l->list + cur->n;
-	last = cur->l->list + cur->l->nr - 1;
+	this = curl->list + cur->n;
+	last = curl->list + curl->nr - 1;
 	while (last >= this) {
 		last[1] = last[0];
 		last--;
 	}
 	*this = new;
-	cur->l->nr++;
+	curl->nr++;
 }
-- 
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