[PATCH 16/34] ptrlist: use iterator API for RESET_PTR_LIST()

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

 



---
 ptrlist.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/ptrlist.h b/ptrlist.h
index 32773b378..728f29593 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -140,11 +140,9 @@ static inline void ptr_cur_init(struct ptr_cur *cur, struct ptr_list *head)
 	}
 
 #define DO_RESET(ptr, __cur, CUR_ENTRY)						\
-	do {										\
-		__cur.n = 0;								\
-		__cur.l = __cur.h;							\
-		if (__cur.h) ptr = CUR_ENTRY(&__cur);					\
-	} while (0)
+	if (!ptr_cur_beg(&__cur, (struct ptr_list *)head) ||				\
+	    !ptr_cur_next(&__cur)) ptr = NULL;						\
+	else ptr = CUR_ENTRY(&__cur);
 
 #define DO_FINISH(ptr, __cur)								\
 		(void)(__cur.n); /* Sanity-check nesting */				\
-- 
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