Re: [PATCH v1 1/4] list: Introduce list_count() to count existing nodes

From: Andy Shevchenko
Date: Mon Nov 14 2022 - 12:58:07 EST


On Mon, Nov 14, 2022 at 05:47:21PM +0000, Matthew Wilcox wrote:
> On Mon, Nov 14, 2022 at 06:03:00PM +0200, Andy Shevchenko wrote:
> > Oh, nice! I will fix this for v2.
>
> list_count() is an antipattern. I don't have any of the patches in
> my inbox, so maybe there's a great reason for doing this, but my
> immediate response is: NAK.

When we are trying to hide iterator variable in many cases, leaving the current
code alive will allow explicit access to it. If it's not a problem, why to
bother with the other list APIs then?

--
With Best Regards,
Andy Shevchenko