A cleaner way to access the private fields of an lt_dlhandle

than my move of the module field into lt_dlinfo:

* libltdl/ltdl.c (lt_caller_data, lt_dlhandle_struct): Move from
here...
* libltdl/lt__private.h (lt_caller_data, lt_dlhandle_struct):
...to here.  And put the module field back here...
* libltdl/ltdl.h (lt_dlinfo): ...instead of here.
* libltdl/loaders/loadlibrary.c (vm_open): Adjust.
This commit is contained in:
Gary V. Vaughan 2004-07-15 12:22:48 +00:00
parent 4257156873
commit 0d8529860b
5 changed files with 41 additions and 32 deletions

View File

@ -1,3 +1,15 @@
2004-07-15 Gary V. Vaughan <gary@gnu.org>
A cleaner way to access the private fields of an lt_dlhandle
than my move of the module field into lt_dlinfo:
* libltdl/ltdl.c (lt_caller_data, lt_dlhandle_struct): Move from
here...
* libltdl/lt__private.h (lt_caller_data, lt_dlhandle_struct):
...to here. And put the module field back here...
* libltdl/ltdl.h (lt_dlinfo): ...instead of here.
* libltdl/loaders/loadlibrary.c (vm_open): Adjust.
2004-07-15 Gary V. Vaughan <gary@gnu.org>
* libltdl/lt__private.h (streq, strneq): New macros to make strcmp

View File

@ -151,14 +151,13 @@ vm_open (lt_user_data loader_data, const char *filename)
find one. */
while (cur = lt_dlhandle_next (cur))
{
const lt_dlinfo *info = lt_dlgetinfo (cur);
if (!info->module)
if (!cur->module)
{
cur = 0;
break;
}
if (info->module == module)
if (cur->module == module)
{
break;
}

View File

@ -88,6 +88,28 @@ void lt__alloc_die_callback (void);
/* --- OPAQUE STRUCTURES DECLARED IN LTDL.H --- */
/* This type is used for the array of caller data sets in each handler. */
typedef struct {
lt_dlcaller_id key;
void * data;
} lt_caller_data;
struct lt_dlhandle_struct {
struct lt_dlhandle_struct *next;
lt_dlloader *loader; /* dlopening interface */
lt_dlinfo info; /* user visible fields */
int depcount; /* number of dependencies */
lt_dlhandle *deplibs; /* dependencies */
lt_module module; /* system module handle */
void * system; /* system specific data */
lt_caller_data *caller_data; /* per caller associated data */
int flags; /* various boolean stats */
};
/* --- ERROR HANDLING --- */
/* Extract the diagnostic strings from the error table macro in the same

View File

@ -58,18 +58,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
/* --- TYPE DEFINITIONS -- */
/* This type is used for the array of caller data sets in each handler. */
typedef struct {
lt_dlcaller_id key;
void * data;
} lt_caller_data;
/* --- OPAQUE STRUCTURES DECLARED IN LTDL.H --- */
@ -86,17 +74,6 @@ struct lt_dlloader {
lt_user_data dlloader_data;
};
struct lt_dlhandle_struct {
struct lt_dlhandle_struct *next;
lt_dlloader *loader; /* dlopening interface */
lt_dlinfo info;
int depcount; /* number of dependencies */
lt_dlhandle *deplibs; /* dependencies */
void * system; /* system specific data */
lt_caller_data *caller_data; /* per caller associated data */
int flags; /* various boolean stats */
};
/* Various boolean flags can be stored in the flags field of an
lt_dlhandle_struct... */
#define LT_DLGET_FLAG(handle, flag) (((handle)->flags & (flag)) == (flag))
@ -414,9 +391,9 @@ tryall_dlopen (lt_dlhandle *handle, const char *filename)
{
lt_user_data data = loader->dlloader_data;
cur->info.module = loader->module_open (data, filename);
cur->module = loader->module_open (data, filename);
if (cur->info.module != 0)
if (cur->module != 0)
{
break;
}
@ -1724,7 +1701,7 @@ lt_dlclose (lt_dlhandle handle)
handles = handle->next;
}
errors += handle->loader->module_close (data, handle->info.module);
errors += handle->loader->module_close (data, handle->module);
errors += unload_deplibs(handle);
/* It is up to the callers to free the data itself. */
@ -1807,7 +1784,7 @@ lt_dlsym (lt_dlhandle handle, const char *symbol)
strcat(sym, symbol);
/* try "modulename_LTX_symbol" */
address = handle->loader->find_sym (data, handle->info.module, sym);
address = handle->loader->find_sym (data, handle->module, sym);
if (address)
{
if (sym != lsym)
@ -1830,7 +1807,7 @@ lt_dlsym (lt_dlhandle handle, const char *symbol)
strcpy(sym, symbol);
}
address = handle->loader->find_sym (data, handle->info.module, sym);
address = handle->loader->find_sym (data, handle->module, sym);
if (sym != lsym)
{
FREE (sym);

View File

@ -116,7 +116,6 @@ typedef struct {
char * name; /* module name */
int ref_count; /* number of times lt_dlopened minus
number of times lt_dlclosed. */
lt_module module; /* system module handle */
} lt_dlinfo;
LT_SCOPE const lt_dlinfo *lt_dlgetinfo (lt_dlhandle handle);