]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: remove XSTD_USE_LIBLTDL, which has not been needed in a long while.
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 20 Jul 2016 14:33:14 +0000 (02:33 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 20 Jul 2016 14:33:14 +0000 (02:33 +1200)
src/LoadableModule.cc

index 7324e9985647bf6d178865aff3c1dfb52744471a..e9efcc34f84179aa4565a972eb215d05b459afa0 100644 (file)
@@ -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 <dlfcn.h>
-#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()
 
 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<lt_dlhandle>(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
 }