[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ltdl bugs
From: |
Jeff Squyres |
Subject: |
Re: ltdl bugs |
Date: |
Sun, 3 Apr 2005 09:19:33 -0400 |
On Apr 3, 2005, at 8:56 AM, Jeff Squyres wrote:
Specifically, it says that if the module is resident, then remove it
from the "handles" list and then free the handle. That's all you need
to do, right?
Heh. It seems that replying to yourself is en vogue on this thread.
;-)
Here's a better (full) patch, featuring:
- remove redundant logic
- re-indent the rest of the function
- use ltdl's indenting style
- add a few comments
- lower carbs
-----
--- ltdl.c.orig 2005-04-03 08:49:11.000000000 -0400
+++ ltdl.c 2005-04-03 09:18:26.000000000 -0400
@@ -3798,10 +3798,8 @@
correctly incase the user decides to reset the residency flag
later (even though the API makes no provision for that at the
moment). */
- if (handle->info.ref_count <= 0 && !LT_DLIS_RESIDENT (handle))
- {
- lt_user_data data = handle->loader->dlloader_data;
-
+ if (handle->info.ref_count <= 0) {
+ /* Remove this handle from the list of handles */
if (handle != handles)
{
last->next = handle->next;
@@ -3811,14 +3809,21 @@
handles = handle->next;
}
- errors += handle->loader->module_close (data, handle->module);
- errors += unload_deplibs(handle);
-
- /* It is up to the callers to free the data itself. */
- LT_DLFREE (handle->caller_data);
-
- LT_DLFREE (handle->info.filename);
- LT_DLFREE (handle->info.name);
+ /* If the module is not resident, then unload, etc. */
+ if (!LT_DLIS_RESIDENT (handle))
+ {
+ lt_user_data data = handle->loader->dlloader_data;
+ errors += handle->loader->module_close (data,
handle->module);
+ errors += unload_deplibs(handle);
+
+ /* It is up to the callers to free the data itself. */
+ LT_DLFREE (handle->caller_data);
+
+ LT_DLFREE (handle->info.filename);
+ LT_DLFREE (handle->info.name);
+ }
+ /* Regardless of whether the module was resident or not, free
+ the handle */
LT_DLFREE (handle);
goto done;
-----
The patch looks longer than it really is simply because of the
re-indentation. All it does is cordon off the section where the module
is unloaded (etc.) to be only for the !RESIDENT case. Removing the
handle from the list of handles and then freeing the handle occurs
regardless of whether the module is resident or not.
Per an off-list mail with Ralf, this is what open source is: I had an
itch (in ltdl) and I scratched it. :-)
Comments welcome.
--
{+} Jeff Squyres
{+} address@hidden
{+} http://www.lam-mpi.org/
- ltdl bugs, Jeff Squyres, 2005/04/01
- Re: ltdl bugs, Peter O'Gorman, 2005/04/02
- Re: ltdl bugs, Peter O'Gorman, 2005/04/02
- Re: ltdl bugs, Jeff Squyres, 2005/04/02
- Re: ltdl bugs, Ralf Wildenhues, 2005/04/03
- Re: ltdl bugs, Ralf Wildenhues, 2005/04/03
- Re: ltdl bugs, Jeff Squyres, 2005/04/03
- Re: ltdl bugs,
Jeff Squyres <=
- Re: ltdl bugs, Ralf Wildenhues, 2005/04/03
- Re: ltdl bugs, Ralf Wildenhues, 2005/04/03
- Re: ltdl bugs, Jeff Squyres, 2005/04/03
- Re: ltdl bugs, Ralf Wildenhues, 2005/04/03
- Re: ltdl bugs, Jeff Squyres, 2005/04/04
- Re: ltdl bugs, Ralf Wildenhues, 2005/04/04
- Re: ltdl bugs, Jeff Squyres, 2005/04/20
- Re: ltdl bugs, Jeff Squyres, 2005/04/03
Re: ltdl bugs, Jeff Squyres, 2005/04/02