rendered paste bodydiff --git a/src/plugin.c b/src/plugin.c
index e3f0d25..91a98ac 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -100,9 +100,6 @@ cloaderLoadPlugin (CompPlugin *p,
const char *path,
const char *name)
{
- if (path)
- return FALSE;
-
if (strcmp (name, coreVTable.name))
return FALSE;
@@ -151,22 +148,25 @@ dlloaderLoadPlugin (CompPlugin *p,
char *file;
void *dlhand;
struct stat fileInfo;
- Bool loaded = FALSE;
+ Bool retval = FALSE;
+
+ if (cloaderLoadPlugin (p, path, name))
+ return TRUE;
+
+ if (!path)
+ return FALSE;
- file = malloc ((path ? strlen (path) : 0) + strlen (name) + 8);
+ file = malloc (strlen (path) + strlen (name) + 8);
if (!file)
return FALSE;
- if (path)
- sprintf (file, "%s/lib%s.so", path, name);
- else
- sprintf (file, "lib%s.so", name);
+ sprintf (file, "%s/lib%s.so", path, name);
if (stat (file, &fileInfo) != 0)
{
- /* file not present - try core plugin or fail */
+ /* file not present - fail */
free (file);
- return cloaderLoadPlugin (p, path, name);
+ return FALSE;
}
dlhand = dlopen (file, RTLD_LAZY);
@@ -199,7 +199,10 @@ dlloaderLoadPlugin (CompPlugin *p,
}
else
{
- loaded = TRUE;
+ p->devPrivate.ptr = dlhand;
+ p->devType = "dlloader";
+
+ retval = TRUE;
}
}
}
@@ -211,18 +214,10 @@ dlloaderLoadPlugin (CompPlugin *p,
free (file);
- if (!loaded)
- {
- if (dlhand)
- dlclose (dlhand);
-
- return FALSE;
- }
-
- p->devPrivate.ptr = dlhand;
- p->devType = "dlloader";
+ if (!retval && dlhand)
+ dlclose (dlhand);
- return TRUE;
+ return retval;
}
static void
@@ -581,10 +576,6 @@ loadPlugin (const char *name)
if (status)
return p;
- status = (*loaderLoadPlugin) (p, NULL, name);
- if (status)
- return p;
-
compLogMessage ("core", CompLogLevelError,
"Couldn't load plugin '%s'", name);
@@ -659,8 +650,8 @@ char **
availablePlugins (int *n)
{
char *home, *plugindir;
- char **list, **currentList, **pluginList, **homeList = NULL;
- int nCurrentList, nPluginList, nHomeList;
+ char **list, **pluginList, **homeList = NULL;
+ int nPluginList, nHomeList;
int count, i, j;
home = getenv ("HOME");
@@ -676,15 +667,12 @@ availablePlugins (int *n)
}
pluginList = (*loaderListPlugins) (PLUGINDIR, &nPluginList);
- currentList = (*loaderListPlugins) (NULL, &nCurrentList);
count = 0;
if (homeList)
count += nHomeList;
if (pluginList)
count += nPluginList;
- if (currentList)
- count += nCurrentList;
if (!count)
return NULL;
@@ -712,15 +700,6 @@ availablePlugins (int *n)
free (pluginList);
}
- if (currentList)
- {
- for (i = 0; i < nCurrentList; i++)
- if (!stringExist (list, j, currentList[i]))
- list[j++] = currentList[i];
-
- free (currentList);
- }
-
*n = j;
return list;