mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-06 17:24:45 +00:00
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>
This commit is contained in:
committed by
Adam Jackson
parent
7b71055fc6
commit
778cfc5976
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user