svn commit: r324541 - in head: share/man/man9 sys/kern sys/sys

Matt Joras mjoras at FreeBSD.org
Sat Oct 14 06:33:17 UTC 2017


On 10/13/2017 22:12, Ngie Cooper (yaneurabeya) wrote:
>> Modified: head/sys/kern/subr_unit.c
>> ==============================================================================
>> --- head/sys/kern/subr_unit.c	Wed Oct 11 20:36:22 2017	(r324540)
>> +++ head/sys/kern/subr_unit.c	Wed Oct 11 21:53:50 2017	(r324541)
>> @@ -366,6 +366,27 @@ delete_unrhdr(struct unrhdr *uh)
>> 	Free(uh);
>> }
>>
>> +void
>> +clear_unrhdr(struct unrhdr *uh)
>> +{
>> +	struct unr *up, *uq;
>> +
>> +	KASSERT(TAILQ_EMPTY(&uh->ppfree),
>> +	    ("unrhdr has postponed item for free"));
>> +	up = TAILQ_FIRST(&uh->head);
>> +	while (up != NULL) {
> Could this be done with TAILQ_FOREACH_SAFE?
> -Ngie


Yes but it is arguably inferior to do so. This while loop is
theoretically faster since there is no need to individually remove the
elements when you intend to delete every element.

Matt



More information about the svn-src-head mailing list