Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): use proper enum constant instead of 0 ...



details:   https://anonhg.NetBSD.org/src/rev/898ce7ef3b13
branches:  trunk
changeset: 1016043:898ce7ef3b13
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 07 20:45:21 2020 +0000

description:
make(1): use proper enum constant instead of 0 for CachedStatsFlags

diffstat:

 usr.bin/make/dir.c |  23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diffs (72 lines):

diff -r ba4d5b6282b4 -r 898ce7ef3b13 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Sat Nov 07 20:39:56 2020 +0000
+++ b/usr.bin/make/dir.c        Sat Nov 07 20:45:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.197 2020/11/07 14:11:58 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.198 2020/11/07 20:45:21 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -134,7 +134,7 @@
 #include "job.h"
 
 /*     "@(#)dir.c      8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: dir.c,v 1.197 2020/11/07 14:11:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.198 2020/11/07 20:45:21 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -312,8 +312,9 @@
 
 /* minimize changes below */
 typedef enum CachedStatsFlags {
-    CST_LSTAT = 0x01,          /* call lstat(2) instead of stat(2) */
-    CST_UPDATE = 0x02          /* ignore existing cached entry */
+    CST_NONE   = 0,
+    CST_LSTAT  = 1 << 0,       /* call lstat(2) instead of stat(2) */
+    CST_UPDATE = 1 << 1        /* ignore existing cached entry */
 } CachedStatsFlags;
 
 /* Returns 0 and the result of stat(2) or lstat(2) in *mst, or -1 on error. */
@@ -377,7 +378,7 @@
 int
 cached_stat(const char *pathname, struct make_stat *st)
 {
-    return cached_stats(&mtimes, pathname, st, 0);
+    return cached_stats(&mtimes, pathname, st, CST_NONE);
 }
 
 int
@@ -1298,6 +1299,7 @@
 {
     char *fullName;            /* the full pathname of name */
     struct make_stat mst;      /* buffer for finding the mod time */
+    CachedStatsFlags flags;
 
     if (gn->type & OP_ARCHV) {
        return Arch_MTime(gn);
@@ -1344,18 +1346,19 @@
        fullName = gn->path;
     }
 
-    if (fullName == NULL) {
+    if (fullName == NULL)
        fullName = bmake_strdup(gn->name);
-    }
+
 
-    if (cached_stats(&mtimes, fullName, &mst, recheck ? CST_UPDATE : 0) < 0) {
+    flags = recheck ? CST_UPDATE : CST_NONE;
+    if (cached_stats(&mtimes, fullName, &mst, flags) < 0) {
        if (gn->type & OP_MEMBER) {
            if (fullName != gn->path)
                free(fullName);
            return Arch_MemberMTime(gn);
-       } else {
-           mst.mst_mtime = 0;
        }
+
+       mst.mst_mtime = 0;
     }
 
     if (fullName != NULL && gn->path == NULL)



Home | Main Index | Thread Index | Old Index