diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2016-04-17 21:07:30 +0100 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-01-25 14:22:05 -0500 |
commit | 778cfc59762cdf528cf8672bfb5696844e91ebc3 (patch) | |
tree | bfc0fea4f4fbb6c5a93887f6014f0965109b8eaa /hw | |
parent | 7b71055fc65242a9c4b651e72bb07dbb3f00c4e6 (diff) |
xfree86: flatten pathlist management in the loader
Now that users can set the path only via LoaderSetPath(), we can simplify
things.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/loader/loadmod.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 5e4d7da79..fd61a826a 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) { @@ -498,7 +488,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; @@ -565,7 +555,6 @@ LoaderListDirs(const char **subdirlist, const char **patternlist) bail: FreePatterns(patterns); FreeSubdirs(subdirs); - FreePathList(pathlist); return (const char **) ret; } @@ -908,7 +897,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) @@ -1033,7 +1022,6 @@ LoadModule(const char *module, const char **subdirlist, ret = NULL; LoadModule_exit: - FreePathList(pathlist); FreePatterns(patterns); free(found); free(name); |