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): reduce pointer indirection for GNode.c...



details:   https://anonhg.NetBSD.org/src/rev/8a6a6fd8898f
branches:  trunk
changeset: 957440:8a6a6fd8898f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 28 19:20:03 2020 +0000

description:
make(1): reduce pointer indirection for GNode.cohorts

diffstat:

 usr.bin/make/compat.c |   6 +++---
 usr.bin/make/make.c   |  10 +++++-----
 usr.bin/make/make.h   |   4 ++--
 usr.bin/make/parse.c  |  16 ++++++++--------
 usr.bin/make/suff.c   |   8 ++++----
 usr.bin/make/targ.c   |  12 ++++++------
 6 files changed, 28 insertions(+), 28 deletions(-)

diffs (231 lines):

diff -r d688ba1c6b64 -r 8a6a6fd8898f usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sat Nov 28 19:16:53 2020 +0000
+++ b/usr.bin/make/compat.c     Sat Nov 28 19:20:03 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.194 2020/11/28 19:12:28 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.195 2020/11/28 19:20:03 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.194 2020/11/28 19:12:28 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.195 2020/11/28 19:20:03 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -652,7 +652,7 @@
        }
 
 cohorts:
-       MakeNodes(gn->cohorts, pgn);
+       MakeNodes(&gn->cohorts, pgn);
 }
 
 /* Initialize this module and start making.
diff -r d688ba1c6b64 -r 8a6a6fd8898f usr.bin/make/make.c
--- a/usr.bin/make/make.c       Sat Nov 28 19:16:53 2020 +0000
+++ b/usr.bin/make/make.c       Sat Nov 28 19:20:03 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.221 2020/11/28 19:16:53 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.222 2020/11/28 19:20:03 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -102,7 +102,7 @@
 #include "job.h"
 
 /*     "@(#)make.c     8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: make.c,v 1.221 2020/11/28 19:16:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.222 2020/11/28 19:20:03 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked_seqno = 1;
@@ -890,7 +890,7 @@
        if (cn->unmade_cohorts != 0) {
                ListNode *ln;
 
-               for (ln = cn->cohorts->first; ln != NULL; ln = ln->next)
+               for (ln = cn->cohorts.first; ln != NULL; ln = ln->next)
                        if (MakeBuildChild(ln->datum, toBeMadeNext) != 0)
                                break;
        }
@@ -1163,7 +1163,7 @@
               gn->name, gn->cohort_num);
 
        if (gn->type & OP_DOUBLEDEP)
-           Lst_PrependAll(examine, gn->cohorts);
+           Lst_PrependAll(examine, &gn->cohorts);
 
        /*
         * Apply any .USE rules before looking for implicit dependencies
@@ -1272,7 +1272,7 @@
        DEBUG1(MAKE, "Make_ProcessWait: examine %s\n", pgn->name);
 
        if (pgn->type & OP_DOUBLEDEP)
-           Lst_PrependAll(examine, pgn->cohorts);
+           Lst_PrependAll(examine, &pgn->cohorts);
 
        owln = pgn->children.first;
        for (ln = pgn->children.first; ln != NULL; ln = ln->next) {
diff -r d688ba1c6b64 -r 8a6a6fd8898f usr.bin/make/make.h
--- a/usr.bin/make/make.h       Sat Nov 28 19:16:53 2020 +0000
+++ b/usr.bin/make/make.h       Sat Nov 28 19:20:03 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.223 2020/11/28 19:16:53 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.224 2020/11/28 19:20:03 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -401,7 +401,7 @@
        GNodeList order_succ;
 
        /* Other nodes of the same name, for the '::' dependency operator. */
-       GNodeList *cohorts;
+       GNodeList cohorts;
        /* The "#n" suffix for this cohort, or "" for other nodes */
        char cohort_num[8];
        /* The number of unmade instances on the cohorts list */
diff -r d688ba1c6b64 -r 8a6a6fd8898f usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Nov 28 19:16:53 2020 +0000
+++ b/usr.bin/make/parse.c      Sat Nov 28 19:20:03 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.456 2020/11/28 19:16:53 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.457 2020/11/28 19:20:03 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.456 2020/11/28 19:16:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.457 2020/11/28 19:20:03 rillig Exp $");
 
 /* types and constants */
 
@@ -758,8 +758,8 @@
 static void
 LinkSource(GNode *pgn, GNode *cgn, Boolean isSpecial)
 {
-    if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(pgn->cohorts))
-       pgn = pgn->cohorts->last->datum;
+    if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(&pgn->cohorts))
+       pgn = pgn->cohorts.last->datum;
 
     Lst_Append(&pgn->children, cgn);
     pgn->unmade++;
@@ -830,7 +830,7 @@
         * traversals will no longer see this node anyway. -mycroft)
         */
        cohort->type = op | OP_INVISIBLE;
-       Lst_Append(gn->cohorts, cohort);
+       Lst_Append(&gn->cohorts, cohort);
        cohort->centurion = gn;
        gn->unmade_cohorts++;
        snprintf(cohort->cohort_num, sizeof cohort->cohort_num, "#%d",
@@ -2055,8 +2055,8 @@
 ParseAddCmd(GNode *gn, char *cmd)
 {
     /* Add to last (ie current) cohort for :: targets */
-    if ((gn->type & OP_DOUBLEDEP) && gn->cohorts->last != NULL)
-       gn = gn->cohorts->last->datum;
+    if ((gn->type & OP_DOUBLEDEP) && gn->cohorts.last != NULL)
+       gn = gn->cohorts.last->datum;
 
     /* if target already supplied, ignore commands */
     if (!(gn->type & OP_HAS_COMMANDS)) {
@@ -3152,7 +3152,7 @@
 
     if (mainNode->type & OP_DOUBLEDEP) {
        Lst_Append(mainList, mainNode);
-       Lst_AppendAll(mainList, mainNode->cohorts);
+       Lst_AppendAll(mainList, &mainNode->cohorts);
     } else
        Lst_Append(mainList, mainNode);
 
diff -r d688ba1c6b64 -r 8a6a6fd8898f usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sat Nov 28 19:16:53 2020 +0000
+++ b/usr.bin/make/suff.c       Sat Nov 28 19:20:03 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.311 2020/11/28 19:16:53 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.312 2020/11/28 19:20:03 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.311 2020/11/28 19:16:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.312 2020/11/28 19:20:03 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -607,8 +607,8 @@
     Suffix *srcSuff, *targSuff;
     SuffixList *srcSuffParents;
 
-    if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts))
-       gn = gn->cohorts->last->datum;
+    if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(&gn->cohorts))
+       gn = gn->cohorts.last->datum;
 
     if (!(gn->type & OP_TRANSFORM))
        return;
diff -r d688ba1c6b64 -r 8a6a6fd8898f usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Sat Nov 28 19:16:53 2020 +0000
+++ b/usr.bin/make/targ.c       Sat Nov 28 19:20:03 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: targ.c,v 1.144 2020/11/28 19:16:53 rillig Exp $        */
+/*     $NetBSD: targ.c,v 1.145 2020/11/28 19:20:04 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -119,7 +119,7 @@
 #include "dir.h"
 
 /*     "@(#)targ.c     8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.144 2020/11/28 19:16:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.145 2020/11/28 19:20:04 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -206,7 +206,7 @@
     Lst_Init(&gn->children);
     Lst_Init(&gn->order_pred);
     Lst_Init(&gn->order_succ);
-    gn->cohorts = Lst_New();
+    Lst_Init(&gn->cohorts);
     gn->cohort_num[0] = '\0';
     gn->unmade_cohorts = 0;
     gn->centurion = NULL;
@@ -239,7 +239,7 @@
     Lst_Done(&gn->children);   /* likewise */
     Lst_Done(&gn->order_pred); /* likewise */
     Lst_Done(&gn->order_succ); /* likewise */
-    Lst_Free(gn->cohorts);     /* likewise */
+    Lst_Done(&gn->cohorts);    /* likewise */
     HashTable_Done(&gn->vars); /* Do not free the variables themselves,
                                 * even though they are owned by this node.
                                 * XXX: they should probably be freed. */
@@ -519,7 +519,7 @@
        Targ_PrintCmds(gn);
        debug_printf("\n\n");
        if (gn->type & OP_DOUBLEDEP) {
-           Targ_PrintNodes(gn->cohorts, pass);
+           Targ_PrintNodes(&gn->cohorts, pass);
        }
     }
 }
@@ -596,7 +596,7 @@
        if (!(type & OP_DOUBLEDEP))
            continue;
 
-       for (cln = gn->cohorts->first; cln != NULL; cln = cln->next) {
+       for (cln = gn->cohorts.first; cln != NULL; cln = cln->next) {
            GNode *cohort = cln->datum;
 
            cohort->type |= type & ~OP_OPMASK;



Home | Main Index | Thread Index | Old Index