[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [libvirt-glib] Prefer 'for' over 'while'



On Thu, Jan 26, 2012 at 08:18:38AM +0100, Philipp Hahn wrote:
> Your changed version only has the same behaviour, if the user-passed-in 
> function iter_func() never changes it->next, which you can't guarentee here. 
> You need to keep the "next" copy.

Yes, the for loop was changed to a while loop recently exactly for that
purpose:

commit e1c15dac18fd5fc3d7c2cbfebb0402c05cc3cee3
http://libvirt.org/git/?p=libvirt-glib.git;a=commit;h=e1c15dac18fd5fc3d7c2cbfebb0402c05cc3cee3

Refactor gvir_config_object_delete_child

By changing gvir_config_xml_foreach_child to make it robust against
current node deletion in the "foreach" callback, we can use
gvir_config_object_foreach_child to implement
gvir_config_object_delete_child

Christophe

Attachment: pgpR3z4jfOW9I.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]