[PATCH 2/5] ptrlist: keep declaration of head-list-nr together

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

 



The list walking macros need to keep some state:
- the head of the list:              head
- the current list 'block':          list
- the current position in the block: nr

Make this clear by keeping their declaration together.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 ptrlist.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ptrlist.h b/ptrlist.h
index 37d866de2..20a156427 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -124,9 +124,10 @@ extern void __free_ptr_list(struct ptr_list **);
 #define DO_FOR_EACH(head, ptr, __head, __list, __nr, PTR_ENTRY) do {	\
 	__typeof__(head) __head = (head);				\
 	__typeof__(head) __list = __head;				\
+	int __nr;							\
 	if (!__head)							\
 		break;							\
-	do { int __nr;							\
+	do {								\
 		for (__nr = 0; __nr < __list->nr; __nr++) {		\
 			ptr = PTR_ENTRY(__list,__nr);			\
 			if (__list->rm && !ptr)				\
@@ -140,9 +141,10 @@ extern void __free_ptr_list(struct ptr_list **);
 #define DO_FOR_EACH_REVERSE(head, ptr, __head, __list, __nr, PTR_ENTRY) do { \
 	__typeof__(head) __head = (head);				\
 	__typeof__(head) __list = __head;				\
+	int __nr;							\
 	if (!head)							\
 		break;							\
-	do { int __nr;							\
+	do {								\
 		__list = __list->prev;					\
 		__nr = __list->nr;					\
 		while (--__nr >= 0) {					\
-- 
2.17.1

--
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