-/* $OpenBSD: main.c,v 1.116 2021/03/11 09:19:16 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.117 2021/03/11 09:21:16 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
/*
* Functions to lookup which files have been accessed during computation.
*/
-static void
+static int
filepath_add(char *file)
{
struct filepath *fp;
/* already in the tree */
free(fp->file);
free(fp);
+ return 0;
}
+
+ return 1;
}
static int
{
struct entity *p;
+ if (filepath_add(file) == 0) {
+ warnx("%s: File already visited", file);
+ return;
+ }
+
if ((p = calloc(1, sizeof(struct entity))) == NULL)
err(1, NULL);
if ((p->descr = strdup(descr)) == NULL)
err(1, NULL);
- filepath_add(file);
-
entity_queue++;
/*