Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make Fix previous: cached_stats() returning < 0 mean...



details:   https://anonhg.NetBSD.org/src/rev/67ce490560ff
branches:  trunk
changeset: 991406:67ce490560ff
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jul 12 18:03:31 2018 +0000

description:
Fix previous: cached_stats() returning < 0 means that the file is not found,
not that it was found in the cache, and centralize reporting.

diffstat:

 usr.bin/make/dir.c |  40 ++++++++++++++++------------------------
 1 files changed, 16 insertions(+), 24 deletions(-)

diffs (97 lines):

diff -r 0616fa70f42d -r 67ce490560ff usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Thu Jul 12 17:46:37 2018 +0000
+++ b/usr.bin/make/dir.c        Thu Jul 12 18:03:31 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.72 2018/07/12 17:46:37 reinoud Exp $ */
+/*     $NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.72 2018/07/12 17:46:37 reinoud Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c      8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.72 2018/07/12 17:46:37 reinoud Exp $");
+__RCSID("$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -289,6 +289,10 @@
        memset(st, 0, sizeof(*st));
        st->st_mtime = cst->mtime;
        st->st_mode = cst->mode;
+        if (DEBUG(DIR)) {
+            fprintf(debug_file, "Using cached time %s for %s\n",
+               Targ_FmtTime(st->st_mtime), pathname);
+       }
        return 0;
     }
 
@@ -306,6 +310,10 @@
     cst = entry->clientPtr;
     cst->mtime = st->st_mtime;
     cst->mode = st->st_mode;
+    if (DEBUG(DIR)) {
+       fprintf(debug_file, "   Caching %s for %s\n",
+           Targ_FmtTime(st->st_mtime), pathname);
+    }
 
     return 0;
 }
@@ -986,14 +994,6 @@
     }
 
     if (cached_stat(file, &stb) == 0) {
-       /*
-        * Save the modification time so if it's needed, we don't have
-        * to fetch it again.
-        */
-       if (DEBUG(DIR)) {
-           fprintf(debug_file, "   Caching %s for %s\n", Targ_FmtTime(stb.st_mtime),
-                   file);
-       }
        nearmisses += 1;
        return (file);
     }
@@ -1386,17 +1386,13 @@
 
     bigmisses += 1;
     if (cached_stat(name, &stb) == 0) {
-       if (DEBUG(DIR)) {
-           fprintf(debug_file, "   Caching %s for %s\n", Targ_FmtTime(stb.st_mtime),
-                   name);
-       }
        return (bmake_strdup(name));
-    } else {
-       if (DEBUG(DIR)) {
-           fprintf(debug_file, "   failed. Returning NULL\n");
-       }
-       return NULL;
     }
+
+    if (DEBUG(DIR)) {
+       fprintf(debug_file, "   failed. Returning NULL\n");
+    }
+    return NULL;
 #endif /* notdef */
 }
 
@@ -1553,10 +1549,6 @@
     }
 
     if (cached_stats(&mtimes, fullName, &stb, recheck ? CST_UPDATE : 0) < 0) {
-        if (DEBUG(DIR)) {
-            fprintf(debug_file, "Using cached time %s for %s\n",
-               Targ_FmtTime(stb.st_mtime), fullName);
-       }
        if (gn->type & OP_MEMBER) {
            if (fullName != gn->path)
                free(fullName);



Home | Main Index | Thread Index | Old Index