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: remove redundant function parameter in su...
details: https://anonhg.NetBSD.org/src/rev/d9a07be85d42
branches: trunk
changeset: 359493:d9a07be85d42
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Jan 07 20:54:45 2022 +0000
description:
make: remove redundant function parameter in suffix handling
Now that mainNode is globally visible, there is no need to pass it
through function parameters.
No functional change.
diffstat:
usr.bin/make/nonints.h | 4 ++--
usr.bin/make/parse.c | 6 +++---
usr.bin/make/suff.c | 23 +++++++++++------------
3 files changed, 16 insertions(+), 17 deletions(-)
diffs (133 lines):
diff -r cdd82df7e81a -r d9a07be85d42 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h Fri Jan 07 20:50:35 2022 +0000
+++ b/usr.bin/make/nonints.h Fri Jan 07 20:54:45 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nonints.h,v 1.232 2022/01/07 20:50:35 rillig Exp $ */
+/* $NetBSD: nonints.h,v 1.233 2022/01/07 20:54:45 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -160,7 +160,7 @@
bool Suff_IsTransform(const char *) MAKE_ATTR_USE;
GNode *Suff_AddTransform(const char *);
void Suff_EndTransform(GNode *);
-void Suff_AddSuffix(const char *, GNode **);
+void Suff_AddSuffix(const char *);
SearchPath *Suff_GetPath(const char *) MAKE_ATTR_USE;
void Suff_ExtendPaths(void);
void Suff_AddInclude(const char *);
diff -r cdd82df7e81a -r d9a07be85d42 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Fri Jan 07 20:50:35 2022 +0000
+++ b/usr.bin/make/parse.c Fri Jan 07 20:54:45 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.631 2022/01/07 20:50:35 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.632 2022/01/07 20:54:45 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -106,7 +106,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.631 2022/01/07 20:50:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.632 2022/01/07 20:54:45 rillig Exp $");
/*
* A file being read.
@@ -1160,7 +1160,7 @@
{
switch (special) {
case SP_SUFFIXES:
- Suff_AddSuffix(word, &mainNode);
+ Suff_AddSuffix(word);
break;
case SP_PATH:
AddToPaths(word, paths);
diff -r cdd82df7e81a -r d9a07be85d42 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c Fri Jan 07 20:50:35 2022 +0000
+++ b/usr.bin/make/suff.c Fri Jan 07 20:54:45 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.363 2022/01/07 20:50:35 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.364 2022/01/07 20:54:45 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -115,7 +115,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.363 2022/01/07 20:50:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.364 2022/01/07 20:54:45 rillig Exp $");
typedef List SuffixList;
typedef ListNode SuffixListNode;
@@ -734,16 +734,15 @@
* true iff a new main target has been selected.
*/
static bool
-UpdateTarget(GNode *target, GNode **inout_main, Suffix *suff,
- bool *inout_removedMain)
+UpdateTarget(GNode *target, Suffix *suff, bool *inout_removedMain)
{
Suffix *srcSuff, *targSuff;
char *ptr;
- if (*inout_main == NULL && *inout_removedMain &&
+ if (mainNode == NULL && *inout_removedMain &&
GNode_IsMainCandidate(target)) {
DEBUG1(MAKE, "Setting main node to \"%s\"\n", target->name);
- *inout_main = target;
+ mainNode = target;
/*
* XXX: Why could it be a good idea to return true here?
* The main task of this function is to turn ordinary nodes
@@ -781,12 +780,12 @@
return false;
if (ParseTransform(target->name, &srcSuff, &targSuff)) {
- if (*inout_main == target) {
+ if (mainNode == target) {
DEBUG1(MAKE,
"Setting main node from \"%s\" back to null\n",
target->name);
*inout_removedMain = true;
- *inout_main = NULL;
+ mainNode = NULL;
}
Lst_Done(&target->children);
Lst_Init(&target->children);
@@ -810,14 +809,14 @@
* suffix rules.
*/
static void
-UpdateTargets(GNode **inout_main, Suffix *suff)
+UpdateTargets(Suffix *suff)
{
bool removedMain = false;
GNodeListNode *ln;
for (ln = Targ_List()->first; ln != NULL; ln = ln->next) {
GNode *gn = ln->datum;
- if (UpdateTarget(gn, inout_main, suff, &removedMain))
+ if (UpdateTarget(gn, suff, &removedMain))
break;
}
}
@@ -836,7 +835,7 @@
* name the name of the suffix to add
*/
void
-Suff_AddSuffix(const char *name, GNode **inout_main)
+Suff_AddSuffix(const char *name)
{
GNodeListNode *ln;
@@ -848,7 +847,7 @@
Lst_Append(&sufflist, suff);
DEBUG1(SUFF, "Adding suffix \"%s\"\n", suff->name);
- UpdateTargets(inout_main, suff);
+ UpdateTargets(suff);
/*
* Look for any existing transformations from or to this suffix.
Home |
Main Index |
Thread Index |
Old Index