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): remove redundant parameter from cached...
details: https://anonhg.NetBSD.org/src/rev/d71865853b9d
branches: trunk
changeset: 1016263:d71865853b9d
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Nov 14 11:51:58 2020 +0000
description:
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.
diffstat:
usr.bin/make/dir.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diffs (55 lines):
diff -r 3ca1354443a6 -r d71865853b9d usr.bin/make/dir.c
--- a/usr.bin/make/dir.c Sat Nov 14 11:42:56 2020 +0000
+++ b/usr.bin/make/dir.c Sat Nov 14 11:51:58 2020 +0000
@@ -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 @@
/* 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 @@
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 @@
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);
Home |
Main Index |
Thread Index |
Old Index