@@ -175,30 +175,19 @@ static inline void ptr_cur_init(struct ptr_cur *cur, struct ptr_list *head)
#define DO_FOR_EACH_REVERSE(head, ptr, __cur, CUR_ENTRY) do { \
struct ptr_cur __cur; \
CHECK_TYPE(head,ptr); \
- DO_INIT(__cur, head); \
- if (!__cur.h) break; \
- do { \
- __cur.l = __cur.l->prev; \
- __cur.n = __cur.l->nr; \
- while (--__cur.n >= 0) { \
- ptr = CUR_ENTRY(&__cur); \
-
+ if (!head) break; \
+ ptr_cur_end(&__cur, (struct ptr_list *)head); \
+ while (ptr_cur_prev(&__cur)) { \
+ ptr = CUR_ENTRY(&__cur);
#define DO_END_FOR_EACH_REVERSE(ptr, __cur) \
- } \
- } while (__cur.l != __cur.h); \
+ } \
} while (0)
#define DO_REVERSE(ptr, __cur, new, __newcur, CUR_ENTRY) do { \
struct ptr_cur __newcur = __cur; \
- new = ptr; \
- goto __inside##new; \
- do { \
- __newcur.l = __newcur.l->prev; \
- __newcur.n = __newcur.l->nr; \
- __inside##new: \
- while (--__newcur.n >= 0) { \
- new = CUR_ENTRY(&__newcur); \
+ while (ptr_cur_prev(&__newcur)) { \
+ new = CUR_ENTRY(&__newcur);
#define RECURSE_PTR_REVERSE(ptr, new) \
DO_REVERSE(ptr, __cur##ptr, \