commit - da660df47e00123e948486c05fac0681db9ae9a8
commit + 2f39769ebedcb3580a530935975b36119e972147
blob - 03da9ddecb31164889973af7c60ec0ff2c9cbda6
blob + b5c17d578b340646cdf373f81fb4df1dd6d52d6d
--- make/make.c
+++ make/make.c
struct timespec
get_mtime (dir, name)
-char *dir, *name;
+struct path *dir;
+char *name;
{
+ extern char *path_cat_str ();
struct stat st;
- char *path = NULL;
+ char *path;
struct timespec t;
- asprintf (&path, "%s/%s", dir, name);
+ path = path_cat_str (dir, name);
if (stat (path, &st) == 0) {
t = st.st_mtim;
memset (&t, 0, sizeof (t));
}
- free (path);
return t;
}
str_push (buf[i]);
}
close (pipefd[0]);
-
- if (wait (NULL) != pid)
- err (1, "wait()");
-
+ wait (NULL);
}
free (args[2]);
f->rule = r;
f->deps = deps;
f->dtail = dt;
- f->mtime = get_mtime (path_to_str (dir), f->name);
+ f->mtime = get_mtime (dir, f->name);
f->help = help;
sc->dir->files = f;
continue;
struct inference *
find_inf (sc, dir, name)
struct scope *sc;
-char *dir, *name;
+struct path *dir;
+char *name;
{
extern struct file *try_find ();
struct inference *inf;
struct file *
try_find (sc, dir, name)
struct scope *sc;
-char *dir, *name;
+struct path *dir;
+char *name;
{
struct inference *inf;
struct timespec t;
goto ret;
}
}
- f = try_find (sc, path_to_str (prefix), name);
+ f = try_find (sc, prefix, name);
if (f == NULL)
errx (1, "%s: no such file: %s", path_to_str (prefix), name);
} else {
- f->mtime = get_mtime (path_to_str (prefix), name);
+ f->mtime = get_mtime (prefix, name);
}
} else {
f = sc->dir->files;
}
if (f->rule == NULL || *f->rule->code == NULL) {
- inf = name != NULL ? find_inf (sc, path_to_str (prefix), name) : NULL;
+ inf = name != NULL ? find_inf (sc, prefix, name) : NULL;
if (inf != NULL) {
inf_inst_file (f, inf);
} else if (f->rule == NULL) {