summaryrefslogtreecommitdiff
path: root/vpath.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-07-21 17:52:13 -0400
committerPaul Smith <psmith@gnu.org>2013-07-21 17:52:13 -0400
commit87ac68fe79a2e3b0d149135d40d8cbc5500024af (patch)
tree78ca3b513d6d7e662117fc824c40f2db2b521b85 /vpath.c
parent72462ef1e181fc99837ba3077f9b5d192f16f6aa (diff)
downloadgunmake-87ac68fe79a2e3b0d149135d40d8cbc5500024af.tar.gz
[Bug #39158] Source cleanups suggested by cppcheck utility.
Diffstat (limited to 'vpath.c')
-rw-r--r--vpath.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/vpath.c b/vpath.c
index 5b7ea93..94956fa 100644
--- a/vpath.c
+++ b/vpath.c
@@ -306,12 +306,13 @@ construct_vpath_list (char *pattern, char *dirpath)
int
gpath_search (const char *file, unsigned int len)
{
- const char **gp;
-
if (gpaths && (len <= gpaths->maxlen))
- for (gp = gpaths->searchpath; *gp != NULL; ++gp)
- if (strneq (*gp, file, len) && (*gp)[len] == '\0')
- return 1;
+ {
+ const char **gp;
+ for (gp = gpaths->searchpath; *gp != NULL; ++gp)
+ if (strneq (*gp, file, len) && (*gp)[len] == '\0')
+ return 1;
+ }
return 0;
}
@@ -334,7 +335,7 @@ selective_vpath_search (struct vpath *path, const char *file,
const char **vpath = path->searchpath;
unsigned int maxvpath = path->maxlen;
unsigned int i;
- unsigned int flen, vlen, name_dplen;
+ unsigned int flen, name_dplen;
int exists = 0;
/* Find out if *FILE is a target.
@@ -374,12 +375,10 @@ selective_vpath_search (struct vpath *path, const char *file,
for (i = 0; vpath[i] != 0; ++i)
{
int exists_in_cache = 0;
- char *p;
-
- p = name;
+ char *p = name;
+ unsigned int vlen = strlen (vpath[i]);
/* Put the next VPATH entry into NAME at P and increment P past it. */
- vlen = strlen (vpath[i]);
memcpy (p, vpath[i], vlen);
p += vlen;