[PATCH 02/34] ptrlist: simplify DO_FOR_EACH_REVERSE/...

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

 



---
 ptrlist.h | 34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)

diff --git a/ptrlist.h b/ptrlist.h
index 9ffbc6e18..9bdce843d 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -170,22 +170,17 @@ static inline void *last_ptr_list(struct ptr_list *list)
 	struct ptr_list *__head = (struct ptr_list *) (head);				\
 	struct ptr_list *__list = __head;						\
 	CHECK_TYPE(head,ptr);								\
-	if (__head) {									\
-		do { int __nr;								\
-			__list = __list->prev;						\
-			__nr = __list->nr;						\
-			while (--__nr >= 0) {						\
-				do {							\
-					ptr = PTR_ENTRY(__list,__nr);			\
-					do {
+	if (!__head) break;								\
+	do { int __nr;									\
+		__list = __list->prev;							\
+		__nr = __list->nr;							\
+		while (--__nr >= 0) {							\
+			ptr = PTR_ENTRY(__list,__nr);					\
 
 
 #define DO_END_FOR_EACH_REVERSE(ptr, __head, __list, __nr)				\
-					} while (0);					\
-				} while (0);						\
-			}								\
-		} while (__list != __head);						\
-	}										\
+		}									\
+	} while (__list != __head);							\
 } while (0)
 
 #define DO_REVERSE(ptr, __head, __list, __nr, new, __newhead,				\
@@ -195,15 +190,12 @@ static inline void *last_ptr_list(struct ptr_list *list)
 	int __newnr = __nr;								\
 	new = ptr;									\
 	goto __inside##new;								\
-	if (1) {									\
-		do {									\
-			__newlist = __newlist->prev;					\
-			__newnr = __newlist->nr;					\
+	do {										\
+		__newlist = __newlist->prev;						\
+		__newnr = __newlist->nr;						\
 	__inside##new:									\
-			while (--__newnr >= 0) {					\
-				do {							\
-					new = PTR_ENTRY(__newlist,__newnr);		\
-					do {
+		while (--__newnr >= 0) {						\
+			new = PTR_ENTRY(__newlist,__newnr);				\
 
 #define RECURSE_PTR_REVERSE(ptr, new)							\
 	DO_REVERSE(ptr, __head##ptr, __list##ptr, __nr##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