Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make tmplen should be static



details:   https://anonhg.NetBSD.org/src/rev/8bd0d375b991
branches:  trunk
changeset: 761801:8bd0d375b991
user:      sjg <sjg%NetBSD.org@localhost>
date:      Tue Feb 08 05:29:13 2011 +0000

description:
tmplen should be static

diffstat:

 usr.bin/make/meta.c |  20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diffs (64 lines):

diff -r d5850c723c13 -r 8bd0d375b991 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Tue Feb 08 03:26:12 2011 +0000
+++ b/usr.bin/make/meta.c       Tue Feb 08 05:29:13 2011 +0000
@@ -713,7 +713,7 @@
     char *p;
     char *cp;
     size_t cwdlen;
-    size_t tmplen = 0;
+    static size_t tmplen = 0;
     FILE *fp;
     Boolean ignoreOODATE = FALSE;
 
@@ -781,6 +781,10 @@
 
            /* Delimit the record type. */
            p = buf;
+#ifdef DEBUG_META_MODE
+           if (DEBUG(META))
+               fprintf(debug_file, "%s: %d: %s\n", fname, lineno, buf);
+#endif
            strsep(&p, " ");
            if (f) {
                /*
@@ -840,6 +844,10 @@
                    /* Skip past the pid. */
                    if (strsep(&p, " ") == NULL)
                        continue;
+#ifdef DEBUG_META_MODE
+                   if (DEBUG(META))
+                       fprintf(debug_file, "%s: %d: cwd=%s ldir=%s\n", fname, lineno, cwd, latestdir);
+#endif
                    break;
                }
 
@@ -876,7 +884,7 @@
                     * they are _expected_ to change.
                     */
                    if (strncmp(p, "/tmp/", 5) == 0 ||
-                       strncmp(p, tmpdir, tmplen) == 0)
+                       (tmplen > 0 && strncmp(p, tmpdir, tmplen) == 0))
                        break;
 
                    if (strncmp(p, "/var/", 5) == 0)
@@ -919,12 +927,20 @@
                        sdirs[sdx++] = NULL;
 
                        for (sdp = sdirs; *sdp && !found; sdp++) {
+#ifdef DEBUG_META_MODE
+                           if (DEBUG(META))
+                               fprintf(debug_file, "%s: %d: looking for: %s\n", fname, lineno, *sdp);
+#endif
                            if (stat(*sdp, &fs) == 0) {
                                found = 1;
                                p = *sdp;
                            }
                        }
                        if (found) {
+#ifdef DEBUG_META_MODE
+                           if (DEBUG(META))
+                               fprintf(debug_file, "%s: %d: found: %s\n", fname, lineno, p);
+#endif
                            if (!S_ISDIR(fs.st_mode) &&
                                fs.st_mtime > gn->mtime) {
                                if (DEBUG(META))



Home | Main Index | Thread Index | Old Index