From: Vladimír Čunát Date: Thu, 25 May 2017 15:30:24 +0000 (+0200) Subject: module.c: cleanup unused code X-Git-Tag: v1.3.0~9^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=352da6ea3c0c03f852206feadfca56ed300787d2;p=thirdparty%2Fknot-resolver.git module.c: cleanup unused code Searching the default library path for modules wasn't a good idea anyway. --- diff --git a/lib/module.c b/lib/module.c index cea899fe8..7d9c91c5b 100644 --- a/lib/module.c +++ b/lib/module.c @@ -54,13 +54,9 @@ static void *load_symbol(void *lib, const char *prefix, const char *name) static int load_library(struct kr_module *module, const char *name, const char *path) { + assert(module && name && path); /* Absolute or relative path (then only library search path is used). */ - auto_free char *lib_path = NULL; - if (path != NULL) { - lib_path = kr_strcatdup(4, path, "/", name, LIBEXT); - } else { - lib_path = kr_strcatdup(2, name, LIBEXT); - } + auto_free char *lib_path = kr_strcatdup(4, path, "/", name, LIBEXT); if (lib_path == NULL) { return kr_error(ENOMEM); } @@ -131,7 +127,7 @@ int kr_module_load(struct kr_module *module, const char *name, const char *path) } /* Search for module library, use current namespace if not found. */ - if (load_library(module, name, path) != 0) { + if (!path || load_library(module, name, path) != 0) { if (load_library(module, name, MODULEDIR) != 0) { module->lib = RTLD_DEFAULT; }