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

_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to