[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

list_for_each_entry() question



Hi,

I see that when you use a macro like:

list_for_each_entry(current, &current->list, list) {
    do_current(current);
}

It goes through all elements but the initial value of current, which
causes me to write code like:


do_current(current); list_for_each_entry(current, &current->list, list) { do_current(current); }

if do_current() is a long list of things, the duplicated code looks
ugly. I could keep a dummy list_head at the beginning to avoid this,
but I don't do that because any element could actually be "beginning".

So how do you get to use list_for_each_entry?

Thanks,
Bahadir

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/