]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
A cleaner way to access the private fields of an lt_dlhandle
authorGary V. Vaughan <gary@gnu.org>
Thu, 15 Jul 2004 12:22:48 +0000 (12:22 +0000)
committerGary V. Vaughan <gary@gnu.org>
Thu, 15 Jul 2004 12:22:48 +0000 (12:22 +0000)
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.

ChangeLog
libltdl/loaders/loadlibrary.c
libltdl/lt__private.h
libltdl/ltdl.c
libltdl/ltdl.h

index 3e5080d9c8d359a1613c086c080766359af11232..dbe9587387c223e1c127dd8cd44a6e8f309f9410 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 2e30b5f15eafd971142aeaadf6aca9e3176f3be6..210217a2715c1bf59a359d1009456ee50dc1c800 100644 (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;
        }
index bf258dbaa41acdfb5feff09f76bc32e24c87aada..e5e7b602fb98d533d7da3fe870f41f12f29817a0 100644 (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
index ff00782cd9a2a379a8e029c69cf3f5afddfef8c2..a78c4fd844d252df02e5fef19eb04bd83fec4ba1 100644 (file)
@@ -58,18 +58,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
 
 
-\f
-/* --- 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;
-
-
-
 \f
 /* --- 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);
index 7c22dd92847830b9011e09fd4881785ab56f7ddc..b2fb7db6e6936b5f543517a3137e0ea7fb9d68c6 100644 (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);