--- ptrlist.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ptrlist.c b/ptrlist.c index 95ff319db..cdc4ae4b0 100644 --- a/ptrlist.c +++ b/ptrlist.c @@ -171,15 +171,19 @@ out: int replace_ptr_list_entry(struct ptr_list **list, void *old_ptr, void *new_ptr, int count) { - void *ptr; + struct ptr_cur cur; + + if (!ptr_cur_beg(&cur, *list)) + goto out; - FOR_EACH_PTR(*list, ptr) { - if (ptr==old_ptr) { - REPLACE_CURRENT_PTR(ptr, new_ptr); + while (ptr_cur_next(&cur)) { + void **this = &cur.l->list[cur.n]; + if (*this == old_ptr) { + *this = new_ptr; if (!--count) goto out; } - }END_FOR_EACH_PTR(ptr); + } assert(count <= 0); out: return count; -- 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