libtool-patches
[Top][All Lists]
Advanced

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

30-gary-append-loaders.patch


From: Gary V. Vaughan
Subject: 30-gary-append-loaders.patch
Date: Thu, 06 Nov 2003 15:25:53 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925 Thunderbird/0.3

Okay to commit?
--
  ())_.  Gary V. Vaughan    gary@(lilith.warpmail.net|gnu.org)
  ( '/   Research Scientist http://www.oranda.demon.co.uk       ,_())____
  / )=   GNU Hacker         http://www.gnu.org/software/libtool  \'      `&
`(_~)_   Tech' Author       http://sources.redhat.com/autobook   =`---d__/
Index: ChangeLog
from  Gary V. Vaughan  <address@hidden>

        * 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.

Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.182
diff -u -p -u -r1.182 ltdl.c
--- libltdl/ltdl.c 6 Nov 2003 13:43:15 -0000 1.182
+++ libltdl/ltdl.c 6 Nov 2003 15:19:21 -0000
@@ -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))
        {

reply via email to

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