[PATCH xserver 4/4] xfree86: flatten pathlist management in the loader
Emil Velikov
emil.l.velikov at gmail.com
Sun Apr 17 20:07:30 UTC 2016
Now that used can set the path only via LoaderSetPath(), we can simplify
things.
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
hw/xfree86/loader/loadmod.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 603ef65..f3512ce 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -127,9 +127,6 @@ InitPathList(const char *path)
int addslash;
int n = 0;
- if (!path)
- return defaultPathList;
-
fullpath = strdup(path);
if (!fullpath)
return NULL;
@@ -171,13 +168,6 @@ InitPathList(const char *path)
return list;
}
-static void
-FreePathList(char **pathlist)
-{
- if (pathlist && pathlist != defaultPathList)
- FreeStringList(pathlist);
-}
-
void
LoaderSetPath(const char *path)
{
@@ -497,7 +487,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
char **ret = NULL;
int n = 0;
- if (!(pathlist = InitPathList(NULL)))
+ if (!(pathlist = defaultPathList))
return NULL;
if (!(subdirs = InitSubdirs(subdirlist)))
goto bail;
@@ -564,7 +554,6 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
bail:
FreePatterns(patterns);
FreeSubdirs(subdirs);
- FreePathList(pathlist);
return (const char **) ret;
}
@@ -904,7 +893,7 @@ LoadModule(const char *module, const char **subdirlist,
goto LoadModule_fail;
}
- pathlist = InitPathList(NULL);
+ pathlist = defaultPathList;
if (!pathlist) {
/* This could be a malloc failure too */
if (errmaj)
@@ -1029,7 +1018,6 @@ LoadModule(const char *module, const char **subdirlist,
ret = NULL;
LoadModule_exit:
- FreePathList(pathlist);
FreePatterns(patterns);
free(found);
free(name);
--
2.8.0
More information about the xorg-devel
mailing list