svn commit: r324541 - in head: share/man/man9 sys/kern sys/sys
Matt Joras
mjoras at FreeBSD.org
Sun Oct 15 03:54:17 UTC 2017
On 10/14/2017 11:03, Mark Johnston wrote:
> TAILQ_FOREACH_SAFE just fetches the next element at the beginning of
> each loop iteration rather than at the end, same as the current
> implementation of clear_unrhdr() does. There's no change to the code
> generated by clang when I replace your loop with:
>
> TAILQ_FOREACH_SAFE(up, &uh->head, list, uq) {
> if (up->ptr != uh) {
> Free(up->ptr);
> }
> Free(up);
> }
Ah, that's a fair point... I was assuming Ngie was suggesting doing a
TAILQ_REMOVE during each iteration, since that's probably the typical
reason to do TAILQ_FOREACH_SAFE. That loop looks better. It would
probably be good to change the queue(3) manpage to suggest that for
deletion.
Matt
More information about the svn-src-head
mailing list