On Thu, 6 June 2013 22:32:55 +0300, Andy Shevchenko wrote: > On Mon, Jun 3, 2013 at 8:28 PM, Joern Engel <jo...@logfs.org> wrote: > > I have seen a lot of boilerplate code that either follows the pattern of > > while (!list_empty(head)) { > > pos = list_entry(head->next, struct foo, list); > > list_del(pos->list); > > ... > > } > > or some variant thereof. > > What the problem to use list_for_each_safe()?
The loop may terminate with elements left on the list. There is more, but I would consider this the main problem. Jörn -- If you're willing to restrict the flexibility of your approach, you can almost always do something better. -- John Carmack -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/