Module Name:    src
Committed By:   rillig
Date:           Sat Nov 14 11:51:58 UTC 2020

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

Log Message:
make(1): remove redundant parameter from cached_stats

The hash table for the cached data depends only on the passed flags,
therefore the caller does not need to know about their existence.


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 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.206 src/usr.bin/make/dir.c:1.207
--- src/usr.bin/make/dir.c:1.206	Sat Nov 14 11:22:17 2020
+++ src/usr.bin/make/dir.c	Sat Nov 14 11:51:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.206 2020/11/14 11:22:17 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.207 2020/11/14 11:51:58 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.206 2020/11/14 11:22:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.207 2020/11/14 11:51:58 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -318,9 +318,10 @@ typedef enum CachedStatsFlags {
 
 /* Returns 0 and the result of stat(2) or lstat(2) in *mst, or -1 on error. */
 static int
-cached_stats(HashTable *tbl, const char *pathname, struct make_stat *mst,
+cached_stats(const char *pathname, struct make_stat *mst,
 	     CachedStatsFlags flags)
 {
+    HashTable *tbl = flags & CST_LSTAT ? &lmtimes : &mtimes;
     HashEntry *entry;
     struct stat sys_st;
     struct cache_st *cst;
@@ -382,13 +383,13 @@ cached_stats(HashTable *tbl, const char 
 int
 cached_stat(const char *pathname, struct make_stat *st)
 {
-    return cached_stats(&mtimes, pathname, st, CST_NONE);
+    return cached_stats(pathname, st, CST_NONE);
 }
 
 int
 cached_lstat(const char *pathname, struct make_stat *st)
 {
-    return cached_stats(&lmtimes, pathname, st, CST_LSTAT);
+    return cached_stats(pathname, st, CST_LSTAT);
 }
 
 /* Initialize the directories module. */
@@ -1356,7 +1357,7 @@ Dir_UpdateMTime(GNode *gn, Boolean reche
 	fullName = bmake_strdup(gn->name);
 
     flags = recheck ? CST_UPDATE : CST_NONE;
-    if (cached_stats(&mtimes, fullName, &mst, flags) < 0) {
+    if (cached_stats(fullName, &mst, flags) < 0) {
 	if (gn->type & OP_MEMBER) {
 	    if (fullName != gn->path)
 		free(fullName);

Reply via email to