cvs commit: src/sys/nfsclient bootp_subr.c

Yar Tikhiy yar at comp.chem.msu.su
Fri Jun 30 08:39:50 UTC 2006


On Thu, Jun 29, 2006 at 06:07:42PM -0500, Christian S.J. Peron wrote:
> Yar Tikhiy wrote:
> >yar         2006-06-29 15:37:39 UTC
> >
> >  FreeBSD src repository
> >
> >  Modified files:
> >    sys/nfsclient        bootp_subr.c 
> >  Log:
> >  Use the elegant TAILQ_FOREACH() in place of a hand-rolled for() loop.
> >  
> >  Revision  Changes    Path
> >  1.65      +1 -3      src/sys/nfsclient/bootp_subr.c
> >
> >
> >  
> Just as a point of curiosity, in some places, people are using for loops 
> to avoid invalid pointer dereferences in the event that one of the queue 
> items is removed by the code in the loop while iterating. Are you using 
> TAILQ_FOREACH_SAFE() in such places if required?

I was aware of TAILQ_FOREACH_SAFE(), but I didn't meet such places.
All the code I'd changed fell into the simpler, scan'n'find, case.
I was removing bogus ifa->ifa_addr checks from the networking code,
and for some funny reason, almost each check found was sitting next
to an old for() loop begging to be turned into TAILQ_FOREACH().
Did I miss a great idea hidden behind that? :-)

-- 
Yar


More information about the cvs-src mailing list