> -----Original Message-----
> From: Thomas Monjalon <tho...@monjalon.net>
> Sent: Tuesday 5 July 2022 17:16
> To: Khan, Hamza <hamza.k...@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [PATCH 1/2] common: add safe version of foreach-list to Linux
>
> 01/06/2022 12:54, Hamza Khan:
> > Linux EAL does not have the LIST_FOREACH_SAFE version of the iterator
> > macros. Add it.
> >
> > Signed-off-by: Hamza Khan <hamza.k...@intel.com>
> > ---
> > lib/eal/linux/include/rte_os.h | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/lib/eal/linux/include/rte_os.h
> > b/lib/eal/linux/include/rte_os.h index c72bf5b7e6..00d7714181 100644
> > --- a/lib/eal/linux/include/rte_os.h
> > +++ b/lib/eal/linux/include/rte_os.h
> > @@ -26,6 +26,13 @@ extern "C" {
> > #define RTE_STAILQ_HEAD(name, type) STAILQ_HEAD(name, type)
> #define
> > RTE_STAILQ_ENTRY(type) STAILQ_ENTRY(type)
> >
> > +#ifndef LIST_FOREACH_SAFE
> > +#define LIST_FOREACH_SAFE(var, head, field, tvar)
> \
> > + for ((var) = LIST_FIRST((head)); \
> > + (var) && ((tvar) = LIST_NEXT((var), field), 1); \
> > + (var) = (tvar))
> > +#endif
>
> I'm not sure we want to add such thing without a RTE_ prefix.
> And we should not need LIST_*, we have RTE_TAILQ_*.
>
>
I have sent v2 patch with the aforementioned fix.
However Is being held until the list moderator can review it for approval