Re: [RFC PATCH 1/2] add list_for_each_entry_del()

From: Miklos Szeredi
Date: Thu Oct 26 2023 - 05:53:38 EST


On Sat, Oct 21, 2023 at 12:00 PM David Laight <David.Laight@xxxxxxxxxx> wrote:

> Adding a list_del_first() function that returns the deleted
> item or NULL to optimise it might make more sense.

Something like this?

- list_for_each_entry_del(entry, head, member))
+ while (list_del_first(entry, head, member))

This allows the compact loop condition, and I always hated having to
pass the type to list_*entry()... Disadvantage being that the
assignment is now implicit (just as with all the list iterators).

Thanks,
Miklos