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): move documentation for MakeAddAllSrc t...



details:   https://anonhg.NetBSD.org/src/rev/cb92caa037c0
branches:  trunk
changeset: 955222:cb92caa037c0
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Sep 24 07:32:03 2020 +0000

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

diffstat:

 usr.bin/make/lst.c  |  12 ++++++++++--
 usr.bin/make/lst.h  |   8 +++++++-
 usr.bin/make/make.c |  34 ++++++++++++++++------------------
 3 files changed, 33 insertions(+), 21 deletions(-)

diffs (131 lines):

diff -r 611bdb30dfd6 -r cb92caa037c0 usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Thu Sep 24 07:23:26 2020 +0000
+++ b/usr.bin/make/lst.c        Thu Sep 24 07:32:03 2020 +0000
@@ -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 @@
     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. */
diff -r 611bdb30dfd6 -r cb92caa037c0 usr.bin/make/lst.h
--- a/usr.bin/make/lst.h        Thu Sep 24 07:23:26 2020 +0000
+++ b/usr.bin/make/lst.h        Thu Sep 24 07:32:03 2020 +0000
@@ -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 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 @@
 
 /* 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 *);
diff -r 611bdb30dfd6 -r cb92caa037c0 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Thu Sep 24 07:23:26 2020 +0000
+++ b/usr.bin/make/make.c       Thu Sep 24 07:32:03 2020 +0000
@@ -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 @@
     }
 }
 
+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 @@
  *     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 @@
  *-----------------------------------------------------------------------
  */
 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;



Home | Main Index | Thread Index | Old Index