xfree86: loader: use one exit code only for readability

No functional changes. Spaghetti code for the win! \o/

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org>
This commit is contained in:
Tiago Vignatti 2011-03-31 17:46:42 +03:00
parent 7aad7dbf40
commit 74476b700f

View File

@ -483,19 +483,15 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
char *fp; char *fp;
char **listing = NULL; char **listing = NULL;
char **save; char **save;
char **ret = NULL;
int n = 0; int n = 0;
if (!(pathlist = InitPathList(NULL))) if (!(pathlist = InitPathList(NULL)))
return NULL; return NULL;
if (!(subdirs = InitSubdirs(subdirlist))) { if (!(subdirs = InitSubdirs(subdirlist)))
FreePathList(pathlist); goto bail;
return NULL; if (!(patterns = InitPatterns(patternlist)))
} goto bail;
if (!(patterns = InitPatterns(patternlist))) {
FreePathList(pathlist);
FreeSubdirs(subdirs);
return NULL;
}
for (elem = pathlist; *elem; elem++) { for (elem = pathlist; *elem; elem++) {
for (s = subdirs; *s; s++) { for (s = subdirs; *s; s++) {
@ -529,20 +525,14 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
save[n] = NULL; save[n] = NULL;
FreeStringList(save); FreeStringList(save);
} }
FreePathList(pathlist);
FreeSubdirs(subdirs);
FreePatterns(patterns);
closedir(d); closedir(d);
return NULL; goto bail;
} }
listing[n] = malloc(len + 1); listing[n] = malloc(len + 1);
if (!listing[n]) { if (!listing[n]) {
FreeStringList(listing); FreeStringList(listing);
FreePathList(pathlist);
FreeSubdirs(subdirs);
FreePatterns(patterns);
closedir(d); closedir(d);
return NULL; goto bail;
} }
strncpy(listing[n], dp->d_name + match[1].rm_so, strncpy(listing[n], dp->d_name + match[1].rm_so,
len); len);
@ -558,11 +548,13 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
} }
if (listing) if (listing)
listing[n] = NULL; listing[n] = NULL;
ret = listing;
FreePathList(pathlist); bail:
FreeSubdirs(subdirs);
FreePatterns(patterns); FreePatterns(patterns);
return listing; FreeSubdirs(subdirs);
FreePathList(pathlist);
return ret;
} }
void void