Module Name:    src
Committed By:   rillig
Date:           Thu Sep 24 07:32:04 UTC 2020

Modified Files:
        src/usr.bin/make: lst.c lst.h make.c

Log Message:
make(1): move documentation for MakeAddAllSrc to its correct place


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/make/lst.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/make/lst.h
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/make/make.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/lst.c
diff -u src/usr.bin/make/lst.c:1.68 src/usr.bin/make/lst.c:1.69
--- src/usr.bin/make/lst.c:1.68	Thu Sep 24 07:23:26 2020
+++ src/usr.bin/make/lst.c	Thu Sep 24 07:32:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.68 2020/09/24 07:23:26 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.69 2020/09/24 07:32:03 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -36,7 +36,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.68 2020/09/24 07:23:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.69 2020/09/24 07:32:03 rillig Exp $");
 
 struct ListNode {
     struct ListNode *prev;	/* previous element in list */
@@ -415,6 +415,14 @@ Lst_FindDatum(List *list, const void *da
     return NULL;
 }
 
+void
+Lst_ForEach(List *list, LstActionProc proc, void *procData)
+{
+    ListNode *node;
+    for (node = list->first; node != NULL; node = node->next)
+        proc(node->datum, procData);
+}
+
 /* Apply the given function to each element of the given list. The function
  * should return 0 if traversal should continue and non-zero if it should
  * abort. */

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.64 src/usr.bin/make/lst.h:1.65
--- src/usr.bin/make/lst.h:1.64	Thu Sep 24 07:11:29 2020
+++ src/usr.bin/make/lst.h	Thu Sep 24 07:32:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.64 2020/09/24 07:11:29 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.65 2020/09/24 07:32:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -94,6 +94,8 @@ typedef void *LstCopyProc(void *);
 typedef void LstFreeProc(void *);
 /* Return TRUE if the datum matches the args, for Lst_Find. */
 typedef Boolean LstFindProc(const void *datum, const void *args);
+/* An action for Lst_ForEach. */
+typedef void LstActionProc(void *datum, void *args);
 /* An action for Lst_ForEachUntil. */
 typedef int LstActionUntilProc(void *datum, void *args);
 
@@ -152,6 +154,10 @@ void LstNode_SetNull(ListNode *);
 
 /* Iterating over a list, using a callback function */
 
+/* Apply a function to each datum of the list.
+ * The function must not modify the structure of the list, for example by
+ * adding or removing nodes. */
+void Lst_ForEach(List *, LstActionProc, void *);
 /* Apply a function to each datum of the list, until the callback function
  * returns non-zero. */
 int Lst_ForEachUntil(List *, LstActionUntilProc, void *);

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.140 src/usr.bin/make/make.c:1.141
--- src/usr.bin/make/make.c:1.140	Thu Sep 24 07:11:29 2020
+++ src/usr.bin/make/make.c	Thu Sep 24 07:32:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.140 2020/09/24 07:11:29 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.141 2020/09/24 07:32:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
 #include    "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.140 2020/09/24 07:11:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.141 2020/09/24 07:32:03 rillig Exp $");
 
 static unsigned int checked = 1;/* Sequence # to detect recursion */
 static GNodeList *toBeMade;	/* The current fringe of the graph. These
@@ -842,6 +842,15 @@ Make_Update(GNode *cgn)
     }
 }
 
+static int
+MakeUnmark(void *cgnp, void *pgnp MAKE_ATTR_UNUSED)
+{
+    GNode	*cgn = (GNode *)cgnp;
+
+    cgn->type &= ~OP_MARK;
+    return 0;
+}
+
 /*-
  *-----------------------------------------------------------------------
  * MakeAddAllSrc --
@@ -857,6 +866,11 @@ Make_Update(GNode *cgn)
  *	variable if it was actually made (since .JOIN nodes don't have
  *	modification times, the comparison is rather unfair...)..
  *
+ * Input:
+ *	cgnp		The child to add
+ *	pgnp		The parent to whose ALLSRC variable it should
+ *			be added
+ *
  * Results:
  *	Always returns 0
  *
@@ -865,22 +879,6 @@ Make_Update(GNode *cgn)
  *-----------------------------------------------------------------------
  */
 static int
-MakeUnmark(void *cgnp, void *pgnp MAKE_ATTR_UNUSED)
-{
-    GNode	*cgn = (GNode *)cgnp;
-
-    cgn->type &= ~OP_MARK;
-    return 0;
-}
-
-/*
- * Input:
- *	cgnp		The child to add
- *	pgnp		The parent to whose ALLSRC variable it should
- *			be added
- *
- */
-static int
 MakeAddAllSrc(void *cgnp, void *pgnp)
 {
     GNode	*cgn = (GNode *)cgnp;

Reply via email to