From: Gary V. Vaughan Date: Tue, 11 Nov 2003 16:53:31 +0000 (+0000) Subject: * libltdl/ltdl.c (lt_dlinit): Save a function call for each loader X-Git-Tag: release-1-9b~253 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e15eb252580435692e31c944805829e624dfd7da;p=thirdparty%2Flibtool.git * 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. --- diff --git a/ChangeLog b/ChangeLog index dc7a50918..169f42889 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2003-11-11 Gary V. Vaughan + * 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 diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index cfbd565e3..d1bf70624 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -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)) {