From: Amos Jeffries Date: Wed, 20 Jul 2016 14:33:14 +0000 (+1200) Subject: Cleanup: remove XSTD_USE_LIBLTDL, which has not been needed in a long while. X-Git-Tag: SQUID_4_0_13~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=57d6aaab24bb3b4652b45808dc63cd611bea47c9;p=thirdparty%2Fsquid.git Cleanup: remove XSTD_USE_LIBLTDL, which has not been needed in a long while. --- diff --git a/src/LoadableModule.cc b/src/LoadableModule.cc index 7324e99856..e9efcc34f8 100644 --- a/src/LoadableModule.cc +++ b/src/LoadableModule.cc @@ -7,20 +7,8 @@ */ #include "squid.h" - -/* The original code has this constant ./configure-able. - * The "#else" branches use raw dlopen interface and have not been tested. - * We can remove that code if we are going to rely on libtool's ltdl in - * all environments. */ -#define XSTD_USE_LIBLTDL 1 - -#if XSTD_USE_LIBLTDL -#include "libltdl/ltdl.h" /* generated file */ -#else -#include -#endif - #include "base/TextException.h" +#include "libltdl/ltdl.h" /* generated file */ #include "LoadableModule.h" // Note: We must use preprocessor instead of C ifs because if dlopen() @@ -28,29 +16,27 @@ LoadableModule::LoadableModule(const String &aName): theName(aName), theHandle(0) { -# if XSTD_USE_LIBLTDL // Initialise preloaded symbol lookup table. LTDL_SET_PRELOADED_SYMBOLS(); if (lt_dlinit() != 0) throw TexcHere("internal error: cannot initialize libtool module loader"); -# endif } LoadableModule::~LoadableModule() { if (loaded()) unload(); -# if XSTD_USE_LIBLTDL assert(lt_dlexit() == 0); // XXX: replace with a warning -# endif } -bool LoadableModule::loaded() const +bool +LoadableModule::loaded() const { return theHandle != 0; } -void LoadableModule::load(int mode) +void +LoadableModule::load(int mode) { if (loaded()) throw TexcHere("internal error: reusing LoadableModule object"); @@ -61,7 +47,8 @@ void LoadableModule::load(int mode) throw TexcHere(errorMsg()); } -void LoadableModule::unload() +void +LoadableModule::unload() { if (!loaded()) throw TexcHere("internal error: unloading not loaded module"); @@ -72,32 +59,22 @@ void LoadableModule::unload() theHandle = 0; } -void *LoadableModule::openModule(int mode) +void * +LoadableModule::openModule(int mode) { -# if XSTD_USE_LIBLTDL return lt_dlopen(theName.termedBuf()); -# else - return dlopen(theName.termedBuf(), - mode == lmNow ? RTLD_NOW : RTLD_LAZY); -# endif } -bool LoadableModule::closeModule() +bool +LoadableModule::closeModule() { -# if XSTD_USE_LIBLTDL // we cast to avoid including ltdl.h in LoadableModule.h return lt_dlclose(static_cast(theHandle)) == 0; -# else - return dlclose(theHandle) == 0; -# endif } -const char *LoadableModule::errorMsg() +const char * +LoadableModule::errorMsg() { -# if XSTD_USE_LIBLTDL return lt_dlerror(); -# else - return dlerror(); -# endif }