Module Name:    src
Committed By:   rillig
Date:           Sat Nov  7 20:45:21 UTC 2020

Modified Files:
        src/usr.bin/make: dir.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/make/dir.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.197 src/usr.bin/make/dir.c:1.198
--- src/usr.bin/make/dir.c:1.197	Sat Nov  7 14:11:58 2020
+++ src/usr.bin/make/dir.c	Sat Nov  7 20:45:21 2020
@@ -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 @@ struct cache_st {
 
 /* 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 @@ cached_stats(HashTable *htp, const char 
 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 @@ Dir_MTime(GNode *gn, Boolean recheck)
 {
     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 @@ Dir_MTime(GNode *gn, Boolean recheck)
 	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)

Reply via email to