libtool-patches
[Top][All Lists]
Advanced

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

Re: FYI: 277-gary-rename-remaining-troublesome-ltdl-apis.diff


From: Eric Blake
Subject: Re: FYI: 277-gary-rename-remaining-troublesome-ltdl-apis.diff
Date: Wed, 26 Oct 2005 20:00:35 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]