In message <[EMAIL PROTECTED]>, Nate Lawson writes:
>Poul-Henning Kamp wrote:

>> Index: src/sys/kern/subr_bus.c
>> diff -u src/sys/kern/subr_bus.c:1.187 src/sys/kern/subr_bus.c:1.188
>> --- src/sys/kern/subr_bus.c:1.187    Tue Oct  4 22:25:14 2005
>> +++ src/sys/kern/subr_bus.c  Sat Jan 14 09:41:35 2006
>> @@ -2820,7 +2820,7 @@
>>  {
>>      struct resource_list_entry *rle;
>>  
>> -    STAILQ_FOREACH(rle, rl, link) {
>> +    while ((rle = STAILQ_FIRST(rl)) != NULL) {
>>              if (rle->res)
>>                      bus_release_resource(rman_get_device(rle->res),
>>                          rle->type, rle->rid, rle->res);
>
>Isn't that what the STAILQ_FOREACH_SAFE() macro is for?  List traversal 
>with deletion?  Your approach is also fine.

In this case we empty the entire list, so this should be marginally
faster, which is probably irrelevevant, and maybe a tiny bit clearer
on the intent.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to