Gary V. Vaughan <gary <at> gnu.org> writes: > -lt_dlhandle_next (lt_dlhandle place) > +lt_dlhandle_iterate (lt_dlinterface_id iface, lt_dlhandle place) > { > lt__handle *handle = (lt__handle *) place; > + lt__interface_id *iterator = (lt__interface_id *) iface; > + > + assert (iface); /* iface is a required argument */ > > if (!handle) > - { > - /* old style iteration across all handles */ > - iterator = 0; > - handle = (lt__handle *) handles; > - } > - else > - { > - /* otherwise start at the next handle after the passed one */ > - handle = handle->next; > - } > + handle = (lt__handle *) handles; > > - /* advance until the interface check (if we have one) succeeds */ > - while (handle && iterator && iterator->iface > + /* advance while the interface check fails */ > + while (handle && iterator->iface > && ((*iterator->iface) (handle, iterator->id_string) != 0)) > { > handle = handle->next; > }
This doesn't look right to me; it looks like you are heading into an infinite loop with the usage idiom suggested in the manual (handle = lt_dlhandle_iterate (iter, handle);) because the passed-in place is returned without advancing through the list. Shouldn't this have been: if (!handle) handle = (lt__handle *) handles; else handle = handle->next; /* advance while the interface check fails */ ... -- Eric Blake