summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-07 20:09:47 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-23 12:15:07 -0800
commit8e4556f560487f3d07812834d4785441d0a8323c (patch)
treeaf2c5a06004d877ef5fd21202acdbd25cd74f686 /hw
parent05f589d464a961aea8d25632a390fb66a06cd186 (diff)
FindModule: stop copying const char *dirname to char *dirpath
Not needed since 6cf844ab69926b split out the allocation/manipulation into the helper function, leaving FindModule just copying the pointer around, and causing gcc warnings and an unreachable call to free. Also no longer need to store the combined strlen results in dirlen. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/loader/loadmod.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index a21f43d63..c697d74ed 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -437,14 +437,11 @@ FindModule(const char *module, const char *dirname, const char **subdirlist,
PatternPtr patterns)
{
char buf[PATH_MAX + 1];
- char *dirpath = NULL;
char *name = NULL;
- int dirlen;
const char **subdirs = NULL;
const char **s;
- dirpath = (char *)dirname;
- if (strlen(dirpath) > PATH_MAX)
+ if (strlen(dirname) > PATH_MAX)
return NULL;
subdirs = InitSubdirs(subdirlist);
@@ -452,17 +449,15 @@ FindModule(const char *module, const char *dirname, const char **subdirlist,
return NULL;
for (s = subdirs; *s; s++) {
- if ((dirlen = strlen(dirpath) + strlen(*s)) > PATH_MAX)
+ if ((strlen(dirname) + strlen(*s)) > PATH_MAX)
continue;
- strcpy(buf, dirpath);
+ strcpy(buf, dirname);
strcat(buf, *s);
if ((name = FindModuleInSubdir(buf, module)))
break;
}
FreeSubdirs(subdirs);
- if (dirpath != dirname)
- free(dirpath);
return name;
}