[PATCH] tevent_common_context_destructor aims to remove all node from list?

Stefan (metze) Metzmacher metze at samba.org
Mon Jan 12 08:11:27 GMT 2009

Jeremy Allison schrieb:
> On Mon, Jan 12, 2009 at 11:31:08AM +0800, boyang wrote:
>>> the way it was originally written). The only time
>>> you need to do the while() idiom is if you're
>>> deleting elements of the list and can't use
>>> ptr = ptr->next as the last part of the for
>>> as the ptr element was freed.
>> :-). We do are deleting elements of the list here. :-) If we use for
>> statement here, it is:
>> for (ptr = list_head; ptr; ) {
>>     doing stuff;
>>     DLIST_REMOVE(list_head, ptr);
>>     ptr = list_head;
>> }
> Yeah, ok. I spotted that 10 minutes after I sent the damn
> email but it was too late to take back :-). The DLIST
> macro's are tricky to use in a looping context.

It took a while until I got the difference to my original

>> :-) Problems are problems. it is not related to any personal stuffs.
>> Suggestions and critics are welcome. :-)
> I still like for loops better for this :-). While
> loops invite errors here IMHO.

me too:-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.samba.org/archive/samba-technical/attachments/20090112/576b5612/signature.bin

More information about the samba-technical mailing list