]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/ltdl.c (lt_dlinit): Save a function call for each loader
authorGary V. Vaughan <gary@gnu.org>
Tue, 11 Nov 2003 16:53:31 +0000 (16:53 +0000)
committerGary V. Vaughan <gary@gnu.org>
Tue, 11 Nov 2003 16:53:31 +0000 (16:53 +0000)
added to the list, in exchange for appending loaders to the list
with O(N) rather than O(1).  The longest the loader list can ever
get is 4 (on cygwin with dld installed) so it probably constitutes
a small speedup, in addition to making the code much more readable.

ChangeLog
libltdl/ltdl.c

index dc7a509185268e7cde5974288aff7e323d659eeb..169f42889cfeb7623127055b6eefb48741254d08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2003-11-11  Gary V. Vaughan  <gary@gnu.org>
 
+       * libltdl/ltdl.c (lt_dlinit): Save a function call for each loader
+       added to the list, in exchange for appending loaders to the list
+       with O(N) rather than O(1).  The longest the loader list can ever
+       get is 4 (on cygwin with dld installed) so it probably constitutes
+       a small speedup, in addition to making the code much more readable.
+
        * m4/libtool.m4 (AC_LIBTOOL_SETUP): Don't define the value for
        ltmain unconditionally.
        (_LT_PROG_LTMAIN): New macro to ensure that the
index cfbd565e39e3127afc87cca8879d6be750cae4f9..d1bf706247638ba4687fe0b77e77ef5198ff5f7e 100644 (file)
@@ -2183,26 +2183,31 @@ lt_dlinit ()
       handles = 0;
       user_search_path = 0; /* empty search path */
 
-#if defined(__WINDOWS__) || defined(__CYGWIN__)
-      errors += lt_dlloader_add (lt_dlloader_next (0), &sys_wll, "dlopen");
-#endif
-#if HAVE_LIBDL
-      errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dl, "dlopen");
+      /* Append the available loaders to the internal list in the order
+        they should be used -- if the first fails, then try again with
+        the next loader in the chain.  */
+#     define LOADER_APPEND 0
+
+      errors += lt_dlloader_add (LOADER_APPEND, &presym,   "dlpreload");
+#if HAVE_DLD
+      errors += lt_dlloader_add (LOADER_APPEND, &sys_dld,  "dld");
 #endif
-#if HAVE_SHL_LOAD
-      errors += lt_dlloader_add (lt_dlloader_next (0), &sys_shl, "dlopen");
+#if HAVE_DYLD
+      errors += lt_dlloader_add (LOADER_APPEND, &sys_dyld, "dyld");
+      errors += sys_dyld_init();
 #endif
 #ifdef __BEOS__
-      errors += lt_dlloader_add (lt_dlloader_next (0), &sys_bedl, "dlopen");
+      errors += lt_dlloader_add (LOADER_APPEND, &sys_bedl, "dlopen");
 #endif
-#if HAVE_DLD
-      errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dld, "dld");
+#if HAVE_SHL_LOAD
+      errors += lt_dlloader_add (LOADER_APPEND, &sys_shl,  "dlopen");
 #endif
-#if HAVE_DYLD
-       errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dyld, "dyld");
-       errors += sys_dyld_init();
+#if HAVE_LIBDL
+      errors += lt_dlloader_add (LOADER_APPEND, &sys_dl,   "dlopen");
+#endif
+#if defined(__WINDOWS__) || defined(__CYGWIN__)
+      errors += lt_dlloader_add (LOADER_APPEND, &sys_wll,  "dlopen");
 #endif
-      errors += lt_dlloader_add (lt_dlloader_next (0), &presym, "dlpreload");
 
       if (presym_init (presym.dlloader_data))
        {