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

Jeremy Allison jra at samba.org
Mon Jan 12 07:58:02 GMT 2009

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.

> :-) 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.


More information about the samba-technical mailing list