--- ptrlist.h | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/ptrlist.h b/ptrlist.h index 7c8fefe42..32773b378 100644 --- a/ptrlist.h +++ b/ptrlist.h @@ -127,25 +127,17 @@ static inline void ptr_cur_init(struct ptr_cur *cur, struct ptr_list *head) do { \ struct ptr_cur __cur; \ CHECK_TYPE(head,ptr); \ - DO_INIT(__cur, head); \ - if (__cur.h) ptr = CUR_ENTRY(&__cur); \ - else ptr = NULL + if (!ptr_cur_beg(&__cur, (struct ptr_list *)head) || \ + !ptr_cur_next(&__cur)) ptr = NULL; \ + else ptr = CUR_ENTRY(&__cur); #define DO_NEXT(ptr, __cur, CUR_ENTRY) \ - if (ptr) { \ - if (++__cur.n < __cur.l->nr) { \ - ptr = CUR_ENTRY(&__cur); \ - } else { \ - ptr = NULL; \ - do \ - __cur.l = __cur.l->next; \ - while (__cur.l->nr == 0 && __cur.l != __cur.h); \ - if (__cur.l != __cur.h) { \ - __cur.n = 0; \ - ptr = CUR_ENTRY(&__cur); \ - } \ - } \ - } + if (ptr) { \ + if (ptr_cur_next(&__cur)) \ + ptr = CUR_ENTRY(&__cur); \ + else \ + ptr = NULL; \ + } #define DO_RESET(ptr, __cur, CUR_ENTRY) \ do { \ -- 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