@@ -102,17 +102,13 @@ static inline void *first_ptr_list(struct ptr_list *list)
static inline void *last_ptr_list(struct ptr_list *list)
{
- struct ptr_list *head = list;
+ struct ptr_cur cur;
- if (!list)
+ if (!ptr_cur_end(&cur, list))
+ return NULL;
+ if (!ptr_cur_prev(&cur))
return NULL;
- list = list->prev;
- while (list->nr == 0) {
- if (list == head)
- return NULL;
- list = list->prev;
- }
- return PTR_ENTRY(list, list->nr-1);
+ return __PTR_STRIP_TAG(ptr_cur_entry(&cur));
}
#define PTR_DEREF(__head, idx, PTR_ENTRY) ({ \