* src/implicit.c (pattern-search): Remove unneeded 'dir' variable

This commit is contained in:
Jouke Witteveen 2019-10-26 12:24:09 +02:00 committed by Paul Smith
parent e4499a1fb5
commit 057e33d6b5

View File

@ -443,7 +443,6 @@ pattern_search (struct file *file, int archive,
unsigned int deps_found = 0; unsigned int deps_found = 0;
/* NPTR points to the part of the prereq we haven't processed. */ /* NPTR points to the part of the prereq we haven't processed. */
const char *nptr = 0; const char *nptr = 0;
const char *dir = NULL;
int order_only = 0; int order_only = 0;
unsigned int matches; unsigned int matches;
@ -478,7 +477,6 @@ pattern_search (struct file *file, int archive,
memcpy (pathdir, filename, pathlen); memcpy (pathdir, filename, pathlen);
pathdir[pathlen] = '\0'; pathdir[pathlen] = '\0';
} }
dir = pathdir;
} }
if (stemlen > GET_PATH_MAX) if (stemlen > GET_PATH_MAX)
@ -646,7 +644,7 @@ pattern_search (struct file *file, int archive,
/* Parse the expanded string. */ /* Parse the expanded string. */
struct dep *dp = PARSE_FILE_SEQ (&p, struct dep, struct dep *dp = PARSE_FILE_SEQ (&p, struct dep,
order_only ? MAP_NUL : MAP_PIPE, order_only ? MAP_NUL : MAP_PIPE,
add_dir ? dir : NULL, PARSEFS_NONE); add_dir ? pathdir : NULL, PARSEFS_NONE);
*dptr = dp; *dptr = dp;
for (d = dp; d != NULL; d = d->next) for (d = dp; d != NULL; d = d->next)
@ -931,17 +929,13 @@ pattern_search (struct file *file, int archive,
} }
else else
{ {
size_t dirlen = (lastslash + 1) - filename;
char *sp;
/* We want to prepend the directory from /* We want to prepend the directory from
the original FILENAME onto the stem. */ the original FILENAME onto the stem. */
fullstemlen = dirlen + stemlen; fullstemlen = pathlen + stemlen;
sp = alloca (fullstemlen + 1); memcpy (stem_str, filename, pathlen);
memcpy (sp, filename, dirlen); memcpy (stem_str + pathlen, stem, stemlen);
memcpy (sp + dirlen, stem, stemlen); stem_str[fullstemlen] = '\0';
sp[fullstemlen] = '\0'; file->stem = strcache_add (stem_str);
file->stem = strcache_add (sp);
} }
file->cmds = rule->cmds; file->cmds = rule->cmds;