Sat Aug 29 10:41:13 2020 UTC ()
make(1): rename LstNode functions to match their type


(rillig)
diff -r1.122 -r1.123 src/usr.bin/make/dir.c
diff -r1.222 -r1.223 src/usr.bin/make/job.c
diff -r1.55 -r1.56 src/usr.bin/make/lst.c
diff -r1.56 -r1.57 src/usr.bin/make/lst.h
diff -r1.326 -r1.327 src/usr.bin/make/main.c
diff -r1.109 -r1.110 src/usr.bin/make/meta.c
diff -r1.130 -r1.131 src/usr.bin/make/suff.c

cvs diff -r1.122 -r1.123 src/usr.bin/make/dir.c (expand / switch to unified diff)

--- src/usr.bin/make/dir.c 2020/08/29 10:12:06 1.122
+++ src/usr.bin/make/dir.c 2020/08/29 10:41:12 1.123
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: dir.c,v 1.122 2020/08/29 10:12:06 rillig Exp $ */ 1/* $NetBSD: dir.c,v 1.123 2020/08/29 10:41:12 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. 4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -60,34 +60,34 @@ @@ -60,34 +60,34 @@
60 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 60 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 61 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 62 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
63 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 63 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
64 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 64 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 * SUCH DAMAGE. 69 * SUCH DAMAGE.
70 */ 70 */
71 71
72#ifndef MAKE_NATIVE 72#ifndef MAKE_NATIVE
73static char rcsid[] = "$NetBSD: dir.c,v 1.122 2020/08/29 10:12:06 rillig Exp $"; 73static char rcsid[] = "$NetBSD: dir.c,v 1.123 2020/08/29 10:41:12 rillig Exp $";
74#else 74#else
75#include <sys/cdefs.h> 75#include <sys/cdefs.h>
76#ifndef lint 76#ifndef lint
77#if 0 77#if 0
78static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; 78static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
79#else 79#else
80__RCSID("$NetBSD: dir.c,v 1.122 2020/08/29 10:12:06 rillig Exp $"); 80__RCSID("$NetBSD: dir.c,v 1.123 2020/08/29 10:41:12 rillig Exp $");
81#endif 81#endif
82#endif /* not lint */ 82#endif /* not lint */
83#endif 83#endif
84 84
85/*- 85/*-
86 * dir.c -- 86 * dir.c --
87 * Directory searching using wildcards and/or normal names... 87 * Directory searching using wildcards and/or normal names...
88 * Used both for source wildcarding in the Makefile and for finding 88 * Used both for source wildcarding in the Makefile and for finding
89 * implicit sources. 89 * implicit sources.
90 * 90 *
91 * The interface for this module is: 91 * The interface for this module is:
92 * Dir_Init Initialize the module. 92 * Dir_Init Initialize the module.
93 * 93 *
@@ -1737,27 +1737,27 @@ Dir_ClearPath(Lst path) @@ -1737,27 +1737,27 @@ Dir_ClearPath(Lst path)
1737 * None 1737 * None
1738 * 1738 *
1739 * Side Effects: 1739 * Side Effects:
1740 * Reference counts for added dirs are upped. 1740 * Reference counts for added dirs are upped.
1741 * 1741 *
1742 *----------------------------------------------------------------------- 1742 *-----------------------------------------------------------------------
1743 */ 1743 */
1744void 1744void
1745Dir_Concat(Lst path1, Lst path2) 1745Dir_Concat(Lst path1, Lst path2)
1746{ 1746{
1747 LstNode ln; 1747 LstNode ln;
1748 Path *p; 1748 Path *p;
1749 1749
1750 for (ln = Lst_First(path2); ln != NULL; ln = Lst_Succ(ln)) { 1750 for (ln = Lst_First(path2); ln != NULL; ln = LstNode_Next(ln)) {
1751 p = Lst_Datum(ln); 1751 p = Lst_Datum(ln);
1752 if (Lst_Member(path1, p) == NULL) { 1752 if (Lst_Member(path1, p) == NULL) {
1753 p->refCount += 1; 1753 p->refCount += 1;
1754 Lst_Append(path1, p); 1754 Lst_Append(path1, p);
1755 } 1755 }
1756 } 1756 }
1757} 1757}
1758 1758
1759static int 1759static int
1760percentage(int num, int den) 1760percentage(int num, int den)
1761{ 1761{
1762 return den != 0 ? num * 100 / den : 0; 1762 return den != 0 ? num * 100 / den : 0;
1763} 1763}

cvs diff -r1.222 -r1.223 src/usr.bin/make/job.c (expand / switch to unified diff)

--- src/usr.bin/make/job.c 2020/08/29 10:35:03 1.222
+++ src/usr.bin/make/job.c 2020/08/29 10:41:12 1.223
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: job.c,v 1.222 2020/08/29 10:35:03 rillig Exp $ */ 1/* $NetBSD: job.c,v 1.223 2020/08/29 10:41:12 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. 4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -60,34 +60,34 @@ @@ -60,34 +60,34 @@
60 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 60 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 61 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 62 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
63 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 63 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
64 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 64 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 * SUCH DAMAGE. 69 * SUCH DAMAGE.
70 */ 70 */
71 71
72#ifndef MAKE_NATIVE 72#ifndef MAKE_NATIVE
73static char rcsid[] = "$NetBSD: job.c,v 1.222 2020/08/29 10:35:03 rillig Exp $"; 73static char rcsid[] = "$NetBSD: job.c,v 1.223 2020/08/29 10:41:12 rillig Exp $";
74#else 74#else
75#include <sys/cdefs.h> 75#include <sys/cdefs.h>
76#ifndef lint 76#ifndef lint
77#if 0 77#if 0
78static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; 78static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
79#else 79#else
80__RCSID("$NetBSD: job.c,v 1.222 2020/08/29 10:35:03 rillig Exp $"); 80__RCSID("$NetBSD: job.c,v 1.223 2020/08/29 10:41:12 rillig Exp $");
81#endif 81#endif
82#endif /* not lint */ 82#endif /* not lint */
83#endif 83#endif
84 84
85/*- 85/*-
86 * job.c -- 86 * job.c --
87 * handle the creation etc. of our child processes. 87 * handle the creation etc. of our child processes.
88 * 88 *
89 * Interface: 89 * Interface:
90 * Job_Make Start the creation of the given target. 90 * Job_Make Start the creation of the given target.
91 * 91 *
92 * Job_CatchChildren Check for and handle the termination of any 92 * Job_CatchChildren Check for and handle the termination of any
93 * children. This must be called reasonably 93 * children. This must be called reasonably
@@ -699,27 +699,27 @@ JobPrintCommand(void *cmdp, void *jobp) @@ -699,27 +699,27 @@ JobPrintCommand(void *cmdp, void *jobp)
699 const char *cmdTemplate; /* Template to use when printing the 699 const char *cmdTemplate; /* Template to use when printing the
700 * command */ 700 * command */
701 char *cmdStart; /* Start of expanded command */ 701 char *cmdStart; /* Start of expanded command */
702 char *escCmd = NULL; /* Command with quotes/backticks escaped */ 702 char *escCmd = NULL; /* Command with quotes/backticks escaped */
703 char *cmd = (char *)cmdp; 703 char *cmd = (char *)cmdp;
704 Job *job = (Job *)jobp; 704 Job *job = (Job *)jobp;
705 705
706 noSpecials = NoExecute(job->node); 706 noSpecials = NoExecute(job->node);
707 707
708 if (strcmp(cmd, "...") == 0) { 708 if (strcmp(cmd, "...") == 0) {
709 job->node->type |= OP_SAVE_CMDS; 709 job->node->type |= OP_SAVE_CMDS;
710 if ((job->flags & JOB_IGNDOTS) == 0) { 710 if ((job->flags & JOB_IGNDOTS) == 0) {
711 LstNode dotsNode = Lst_Member(job->node->commands, cmd); 711 LstNode dotsNode = Lst_Member(job->node->commands, cmd);
712 job->tailCmds = dotsNode != NULL ? Lst_Succ(dotsNode) : NULL; 712 job->tailCmds = dotsNode != NULL ? LstNode_Next(dotsNode) : NULL;
713 return 1; 713 return 1;
714 } 714 }
715 return 0; 715 return 0;
716 } 716 }
717 717
718#define DBPRINTF(fmt, arg) if (DEBUG(JOB)) { \ 718#define DBPRINTF(fmt, arg) if (DEBUG(JOB)) { \
719 (void)fprintf(debug_file, fmt, arg); \ 719 (void)fprintf(debug_file, fmt, arg); \
720 } \ 720 } \
721 (void)fprintf(job->cmdFILE, fmt, arg); \ 721 (void)fprintf(job->cmdFILE, fmt, arg); \
722 (void)fflush(job->cmdFILE); 722 (void)fflush(job->cmdFILE);
723 723
724 numCommands += 1; 724 numCommands += 1;
725 725

cvs diff -r1.55 -r1.56 src/usr.bin/make/lst.c (expand / switch to unified diff)

--- src/usr.bin/make/lst.c 2020/08/29 10:12:06 1.55
+++ src/usr.bin/make/lst.c 2020/08/29 10:41:12 1.56
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lst.c,v 1.55 2020/08/29 10:12:06 rillig Exp $ */ 1/* $NetBSD: lst.c,v 1.56 2020/08/29 10:41:12 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990, 1993 4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,31 +27,31 @@ @@ -27,31 +27,31 @@
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 */ 33 */
34 34
35#include <stdint.h> 35#include <stdint.h>
36 36
37#include "make.h" 37#include "make.h"
38 38
39#ifndef MAKE_NATIVE 39#ifndef MAKE_NATIVE
40static char rcsid[] = "$NetBSD: lst.c,v 1.55 2020/08/29 10:12:06 rillig Exp $"; 40static char rcsid[] = "$NetBSD: lst.c,v 1.56 2020/08/29 10:41:12 rillig Exp $";
41#else 41#else
42#include <sys/cdefs.h> 42#include <sys/cdefs.h>
43#ifndef lint 43#ifndef lint
44__RCSID("$NetBSD: lst.c,v 1.55 2020/08/29 10:12:06 rillig Exp $"); 44__RCSID("$NetBSD: lst.c,v 1.56 2020/08/29 10:41:12 rillig Exp $");
45#endif /* not lint */ 45#endif /* not lint */
46#endif 46#endif
47 47
48struct ListNode { 48struct ListNode {
49 struct ListNode *prev; /* previous element in list */ 49 struct ListNode *prev; /* previous element in list */
50 struct ListNode *next; /* next in list */ 50 struct ListNode *next; /* next in list */
51 uint8_t useCount; /* Count of functions using the node. 51 uint8_t useCount; /* Count of functions using the node.
52 * node may not be deleted until count 52 * node may not be deleted until count
53 * goes to 0 */ 53 * goes to 0 */
54 Boolean deleted; /* List node should be removed when done */ 54 Boolean deleted; /* List node should be removed when done */
55 union { 55 union {
56 void *datum; /* datum associated with this element */ 56 void *datum; /* datum associated with this element */
57 const GNode *gnode; /* alias, just for debugging */ 57 const GNode *gnode; /* alias, just for debugging */
@@ -328,36 +328,36 @@ Lst_First(Lst list) @@ -328,36 +328,36 @@ Lst_First(Lst list)
328} 328}
329 329
330/* Return the last node from the given list, or NULL if the list is empty. */ 330/* Return the last node from the given list, or NULL if the list is empty. */
331LstNode 331LstNode
332Lst_Last(Lst list) 332Lst_Last(Lst list)
333{ 333{
334 assert(list != NULL); 334 assert(list != NULL);
335 335
336 return list->last; 336 return list->last;
337} 337}
338 338
339/* Return the successor to the given node on its list, or NULL. */ 339/* Return the successor to the given node on its list, or NULL. */
340LstNode 340LstNode
341Lst_Succ(LstNode node) 341LstNode_Next(LstNode node)
342{ 342{
343 assert(node != NULL); 343 assert(node != NULL);
344 344
345 return node->next; 345 return node->next;
346} 346}
347 347
348/* Return the predecessor to the given node on its list, or NULL. */ 348/* Return the predecessor to the given node on its list, or NULL. */
349LstNode 349LstNode
350Lst_Prev(LstNode node) 350LstNode_Prev(LstNode node)
351{ 351{
352 assert(node != NULL); 352 assert(node != NULL);
353 return node->prev; 353 return node->prev;
354} 354}
355 355
356/* Return the datum stored in the given node. */ 356/* Return the datum stored in the given node. */
357void * 357void *
358Lst_Datum(LstNode node) 358Lst_Datum(LstNode node)
359{ 359{
360 assert(node != NULL); 360 assert(node != NULL);
361 return node->datum; 361 return node->datum;
362} 362}
363 363
@@ -377,27 +377,27 @@ Lst_IsEmpty(Lst list) @@ -377,27 +377,27 @@ Lst_IsEmpty(Lst list)
377 377
378/* Return the first node from the list for which the match function returns 378/* Return the first node from the list for which the match function returns
379 * TRUE, or NULL if none of the nodes matched. */ 379 * TRUE, or NULL if none of the nodes matched. */
380LstNode 380LstNode
381Lst_Find(Lst list, LstFindProc match, const void *matchArgs) 381Lst_Find(Lst list, LstFindProc match, const void *matchArgs)
382{ 382{
383 return Lst_FindFrom(list, Lst_First(list), match, matchArgs); 383 return Lst_FindFrom(list, Lst_First(list), match, matchArgs);
384} 384}
385 385
386/* Return the first node from the list, starting at the given node, for which 386/* Return the first node from the list, starting at the given node, for which
387 * the match function returns TRUE, or NULL if none of the nodes matches. 387 * the match function returns TRUE, or NULL if none of the nodes matches.
388 * 388 *
389 * The start node may be NULL, in which case nothing is found. This allows 389 * The start node may be NULL, in which case nothing is found. This allows
390 * for passing Lst_First or Lst_Succ as the start node. */ 390 * for passing Lst_First or LstNode_Next as the start node. */
391LstNode 391LstNode
392Lst_FindFrom(Lst list, LstNode node, LstFindProc match, const void *matchArgs) 392Lst_FindFrom(Lst list, LstNode node, LstFindProc match, const void *matchArgs)
393{ 393{
394 LstNode tln; 394 LstNode tln;
395 395
396 assert(list != NULL); 396 assert(list != NULL);
397 assert(match != NULL); 397 assert(match != NULL);
398 398
399 for (tln = node; tln != NULL; tln = tln->next) { 399 for (tln = node; tln != NULL; tln = tln->next) {
400 if (match(tln->datum, matchArgs)) 400 if (match(tln->datum, matchArgs))
401 return tln; 401 return tln;
402 } 402 }
403 403

cvs diff -r1.56 -r1.57 src/usr.bin/make/lst.h (expand / switch to unified diff)

--- src/usr.bin/make/lst.h 2020/08/29 10:12:06 1.56
+++ src/usr.bin/make/lst.h 2020/08/29 10:41:12 1.57
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lst.h,v 1.56 2020/08/29 10:12:06 rillig Exp $ */ 1/* $NetBSD: lst.h,v 1.57 2020/08/29 10:41:12 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. 4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -125,29 +125,29 @@ void LstNode_SetNull(LstNode); @@ -125,29 +125,29 @@ void LstNode_SetNull(LstNode);
125 125
126void Lst_PrependAll(Lst, Lst); 126void Lst_PrependAll(Lst, Lst);
127void Lst_AppendAll(Lst, Lst); 127void Lst_AppendAll(Lst, Lst);
128void Lst_MoveAll(Lst, Lst); 128void Lst_MoveAll(Lst, Lst);
129 129
130/* 130/*
131 * Node-specific functions 131 * Node-specific functions
132 */ 132 */
133/* Return first element in list */ 133/* Return first element in list */
134LstNode Lst_First(Lst); 134LstNode Lst_First(Lst);
135/* Return last element in list */ 135/* Return last element in list */
136LstNode Lst_Last(Lst); 136LstNode Lst_Last(Lst);
137/* Return successor to given element */ 137/* Return successor to given element */
138LstNode Lst_Succ(LstNode); 138LstNode LstNode_Next(LstNode);
139/* Return predecessor to given element */ 139/* Return predecessor to given element */
140LstNode Lst_Prev(LstNode); 140LstNode LstNode_Prev(LstNode);
141/* Get datum from LstNode */ 141/* Get datum from LstNode */
142void *Lst_Datum(LstNode); 142void *Lst_Datum(LstNode);
143 143
144/* 144/*
145 * Functions for entire lists 145 * Functions for entire lists
146 */ 146 */
147/* Find an element in a list */ 147/* Find an element in a list */
148LstNode Lst_Find(Lst, LstFindProc, const void *); 148LstNode Lst_Find(Lst, LstFindProc, const void *);
149/* Find an element starting from somewhere */ 149/* Find an element starting from somewhere */
150LstNode Lst_FindFrom(Lst, LstNode, LstFindProc, const void *); 150LstNode Lst_FindFrom(Lst, LstNode, LstFindProc, const void *);
151/* 151/*
152 * See if the given datum is on the list. Returns the LstNode containing 152 * See if the given datum is on the list. Returns the LstNode containing
153 * the datum 153 * the datum

cvs diff -r1.326 -r1.327 src/usr.bin/make/main.c (expand / switch to unified diff)

--- src/usr.bin/make/main.c 2020/08/29 10:12:06 1.326
+++ src/usr.bin/make/main.c 2020/08/29 10:41:12 1.327
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: main.c,v 1.326 2020/08/29 10:12:06 rillig Exp $ */ 1/* $NetBSD: main.c,v 1.327 2020/08/29 10:41:12 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990, 1993 4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -59,39 +59,39 @@ @@ -59,39 +59,39 @@
59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 * SUCH DAMAGE. 68 * SUCH DAMAGE.
69 */ 69 */
70 70
71#ifndef MAKE_NATIVE 71#ifndef MAKE_NATIVE
72static char rcsid[] = "$NetBSD: main.c,v 1.326 2020/08/29 10:12:06 rillig Exp $"; 72static char rcsid[] = "$NetBSD: main.c,v 1.327 2020/08/29 10:41:12 rillig Exp $";
73#else 73#else
74#include <sys/cdefs.h> 74#include <sys/cdefs.h>
75#ifndef lint 75#ifndef lint
76__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ 76__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
77 The Regents of the University of California. All rights reserved."); 77 The Regents of the University of California. All rights reserved.");
78#endif /* not lint */ 78#endif /* not lint */
79 79
80#ifndef lint 80#ifndef lint
81#if 0 81#if 0
82static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; 82static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
83#else 83#else
84__RCSID("$NetBSD: main.c,v 1.326 2020/08/29 10:12:06 rillig Exp $"); 84__RCSID("$NetBSD: main.c,v 1.327 2020/08/29 10:41:12 rillig Exp $");
85#endif 85#endif
86#endif /* not lint */ 86#endif /* not lint */
87#endif 87#endif
88 88
89/*- 89/*-
90 * main.c -- 90 * main.c --
91 * The main file for this entire program. Exit routines etc 91 * The main file for this entire program. Exit routines etc
92 * reside here. 92 * reside here.
93 * 93 *
94 * Utility functions defined in this file: 94 * Utility functions defined in this file:
95 * Main_ParseArgLine Takes a line of arguments, breaks them and 95 * Main_ParseArgLine Takes a line of arguments, breaks them and
96 * treats them as if they were given when first 96 * treats them as if they were given when first
97 * invoked. Used by the parse module to implement 97 * invoked. Used by the parse module to implement
@@ -863,27 +863,27 @@ MakeMode(const char *mode) @@ -863,27 +863,27 @@ MakeMode(const char *mode)
863static void 863static void
864doPrintVars(void) 864doPrintVars(void)
865{ 865{
866 LstNode ln; 866 LstNode ln;
867 Boolean expandVars; 867 Boolean expandVars;
868 868
869 if (printVars == EXPAND_VARS) 869 if (printVars == EXPAND_VARS)
870 expandVars = TRUE; 870 expandVars = TRUE;
871 else if (debugVflag) 871 else if (debugVflag)
872 expandVars = FALSE; 872 expandVars = FALSE;
873 else 873 else
874 expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE); 874 expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE);
875 875
876 for (ln = Lst_First(variables); ln != NULL; ln = Lst_Succ(ln)) { 876 for (ln = Lst_First(variables); ln != NULL; ln = LstNode_Next(ln)) {
877 char *var = Lst_Datum(ln); 877 char *var = Lst_Datum(ln);
878 const char *value; 878 const char *value;
879 char *p1; 879 char *p1;
880 880
881 if (strchr(var, '$')) { 881 if (strchr(var, '$')) {
882 value = p1 = Var_Subst(var, VAR_GLOBAL, VARE_WANTRES); 882 value = p1 = Var_Subst(var, VAR_GLOBAL, VARE_WANTRES);
883 } else if (expandVars) { 883 } else if (expandVars) {
884 char tmp[128]; 884 char tmp[128];
885 int len = snprintf(tmp, sizeof(tmp), "${%s}", var); 885 int len = snprintf(tmp, sizeof(tmp), "${%s}", var);
886 886
887 if (len >= (int)sizeof(tmp)) 887 if (len >= (int)sizeof(tmp))
888 Fatal("%s: variable name too big: %s", 888 Fatal("%s: variable name too big: %s",
889 progname, var); 889 progname, var);
@@ -1272,27 +1272,27 @@ main(int argc, char **argv) @@ -1272,27 +1272,27 @@ main(int argc, char **argv)
1272 DEFAULT = NULL; 1272 DEFAULT = NULL;
1273 (void)time(&now); 1273 (void)time(&now);
1274 1274
1275 Trace_Log(MAKESTART, NULL); 1275 Trace_Log(MAKESTART, NULL);
1276 1276
1277 /* 1277 /*
1278 * Set up the .TARGETS variable to contain the list of targets to be 1278 * Set up the .TARGETS variable to contain the list of targets to be
1279 * created. If none specified, make the variable empty -- the parser 1279 * created. If none specified, make the variable empty -- the parser
1280 * will fill the thing in with the default or .MAIN target. 1280 * will fill the thing in with the default or .MAIN target.
1281 */ 1281 */
1282 if (!Lst_IsEmpty(create)) { 1282 if (!Lst_IsEmpty(create)) {
1283 LstNode ln; 1283 LstNode ln;
1284 1284
1285 for (ln = Lst_First(create); ln != NULL; ln = Lst_Succ(ln)) { 1285 for (ln = Lst_First(create); ln != NULL; ln = LstNode_Next(ln)) {
1286 char *name = Lst_Datum(ln); 1286 char *name = Lst_Datum(ln);
1287 Var_Append(".TARGETS", name, VAR_GLOBAL); 1287 Var_Append(".TARGETS", name, VAR_GLOBAL);
1288 } 1288 }
1289 } else 1289 } else
1290 Var_Set(".TARGETS", "", VAR_GLOBAL); 1290 Var_Set(".TARGETS", "", VAR_GLOBAL);
1291 1291
1292 1292
1293 /* 1293 /*
1294 * If no user-supplied system path was given (through the -m option) 1294 * If no user-supplied system path was given (through the -m option)
1295 * add the directories from the DEFSYSPATH (more than one may be given 1295 * add the directories from the DEFSYSPATH (more than one may be given
1296 * as dir1:...:dirn) to the system include path. 1296 * as dir1:...:dirn) to the system include path.
1297 */ 1297 */
1298 /* XXX: mismatch: the -m option sets sysIncPath, not syspath */ 1298 /* XXX: mismatch: the -m option sets sysIncPath, not syspath */

cvs diff -r1.109 -r1.110 src/usr.bin/make/meta.c (expand / switch to unified diff)

--- src/usr.bin/make/meta.c 2020/08/29 10:12:06 1.109
+++ src/usr.bin/make/meta.c 2020/08/29 10:41:12 1.110
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: meta.c,v 1.109 2020/08/29 10:12:06 rillig Exp $ */ 1/* $NetBSD: meta.c,v 1.110 2020/08/29 10:41:12 rillig Exp $ */
2 2
3/* 3/*
4 * Implement 'meta' mode. 4 * Implement 'meta' mode.
5 * Adapted from John Birrell's patches to FreeBSD make. 5 * Adapted from John Birrell's patches to FreeBSD make.
6 * --sjg 6 * --sjg
7 */ 7 */
8/* 8/*
9 * Copyright (c) 2009-2016, Juniper Networks, Inc. 9 * Copyright (c) 2009-2016, Juniper Networks, Inc.
10 * Portions Copyright (c) 2009, John Birrell. 10 * Portions Copyright (c) 2009, John Birrell.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -1314,28 +1314,29 @@ meta_oodate(GNode *gn, Boolean oodate) @@ -1314,28 +1314,29 @@ meta_oodate(GNode *gn, Boolean oodate)
1314 /* 'L' and 'M' put single quotes around the args */ 1314 /* 'L' and 'M' put single quotes around the args */
1315 DEQUOTE(p); 1315 DEQUOTE(p);
1316 DEQUOTE(move_target); 1316 DEQUOTE(move_target);
1317 /* FALLTHROUGH */ 1317 /* FALLTHROUGH */
1318 case 'D': /* unlink */ 1318 case 'D': /* unlink */
1319 if (*p == '/' && !Lst_IsEmpty(missingFiles)) { 1319 if (*p == '/' && !Lst_IsEmpty(missingFiles)) {
1320 /* remove any missingFiles entries that match p */ 1320 /* remove any missingFiles entries that match p */
1321 ln = Lst_Find(missingFiles, path_match, p); 1321 ln = Lst_Find(missingFiles, path_match, p);
1322 if (ln != NULL) { 1322 if (ln != NULL) {
1323 LstNode nln; 1323 LstNode nln;
1324 char *tp; 1324 char *tp;
1325 1325
1326 do { 1326 do {
1327 nln = Lst_FindFrom(missingFiles, Lst_Succ(ln), 1327 nln = Lst_FindFrom(missingFiles,
1328 path_match, p); 1328 LstNode_Next(ln),
 1329 path_match, p);
1329 tp = Lst_Datum(ln); 1330 tp = Lst_Datum(ln);
1330 Lst_Remove(missingFiles, ln); 1331 Lst_Remove(missingFiles, ln);
1331 free(tp); 1332 free(tp);
1332 } while ((ln = nln) != NULL); 1333 } while ((ln = nln) != NULL);
1333 } 1334 }
1334 } 1335 }
1335 if (buf[0] == 'M') { 1336 if (buf[0] == 'M') {
1336 /* the target of the mv is a file 'W'ritten */ 1337 /* the target of the mv is a file 'W'ritten */
1337#ifdef DEBUG_META_MODE 1338#ifdef DEBUG_META_MODE
1338 if (DEBUG(META)) 1339 if (DEBUG(META))
1339 fprintf(debug_file, "meta_oodate: M %s -> %s\n", 1340 fprintf(debug_file, "meta_oodate: M %s -> %s\n",
1340 p, move_target); 1341 p, move_target);
1341#endif 1342#endif
@@ -1547,27 +1548,27 @@ meta_oodate(GNode *gn, Boolean oodate) @@ -1547,27 +1548,27 @@ meta_oodate(GNode *gn, Boolean oodate)
1547 if (buf[x - 1] == '\n') 1548 if (buf[x - 1] == '\n')
1548 buf[x - 1] = '\0'; 1549 buf[x - 1] = '\0';
1549 } 1550 }
1550 if (p && 1551 if (p &&
1551 !hasOODATE && 1552 !hasOODATE &&
1552 !(gn->type & OP_NOMETA_CMP) && 1553 !(gn->type & OP_NOMETA_CMP) &&
1553 strcmp(p, cmd) != 0) { 1554 strcmp(p, cmd) != 0) {
1554 if (DEBUG(META)) 1555 if (DEBUG(META))
1555 fprintf(debug_file, "%s: %d: a build command has changed\n%s\nvs\n%s\n", fname, lineno, p, cmd); 1556 fprintf(debug_file, "%s: %d: a build command has changed\n%s\nvs\n%s\n", fname, lineno, p, cmd);
1556 if (!metaIgnoreCMDs) 1557 if (!metaIgnoreCMDs)
1557 oodate = TRUE; 1558 oodate = TRUE;
1558 } 1559 }
1559 free(cmd); 1560 free(cmd);
1560 ln = Lst_Succ(ln); 1561 ln = LstNode_Next(ln);
1561 } 1562 }
1562 } else if (strcmp(buf, "CWD") == 0) { 1563 } else if (strcmp(buf, "CWD") == 0) {
1563 /* 1564 /*
1564 * Check if there are extra commands now 1565 * Check if there are extra commands now
1565 * that weren't in the meta data file. 1566 * that weren't in the meta data file.
1566 */ 1567 */
1567 if (!oodate && ln != NULL) { 1568 if (!oodate && ln != NULL) {
1568 if (DEBUG(META)) 1569 if (DEBUG(META))
1569 fprintf(debug_file, "%s: %d: there are extra build commands now that weren't in the meta data file\n", fname, lineno); 1570 fprintf(debug_file, "%s: %d: there are extra build commands now that weren't in the meta data file\n", fname, lineno);
1570 oodate = TRUE; 1571 oodate = TRUE;
1571 } 1572 }
1572 CHECK_VALID_META(p); 1573 CHECK_VALID_META(p);
1573 if (strcmp(p, cwd) != 0) { 1574 if (strcmp(p, cwd) != 0) {

cvs diff -r1.130 -r1.131 src/usr.bin/make/suff.c (expand / switch to unified diff)

--- src/usr.bin/make/suff.c 2020/08/29 10:12:06 1.130
+++ src/usr.bin/make/suff.c 2020/08/29 10:41:12 1.131
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: suff.c,v 1.130 2020/08/29 10:12:06 rillig Exp $ */ 1/* $NetBSD: suff.c,v 1.131 2020/08/29 10:41:12 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990, 1993 4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -59,34 +59,34 @@ @@ -59,34 +59,34 @@
59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 * SUCH DAMAGE. 68 * SUCH DAMAGE.
69 */ 69 */
70 70
71#ifndef MAKE_NATIVE 71#ifndef MAKE_NATIVE
72static char rcsid[] = "$NetBSD: suff.c,v 1.130 2020/08/29 10:12:06 rillig Exp $"; 72static char rcsid[] = "$NetBSD: suff.c,v 1.131 2020/08/29 10:41:12 rillig Exp $";
73#else 73#else
74#include <sys/cdefs.h> 74#include <sys/cdefs.h>
75#ifndef lint 75#ifndef lint
76#if 0 76#if 0
77static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; 77static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
78#else 78#else
79__RCSID("$NetBSD: suff.c,v 1.130 2020/08/29 10:12:06 rillig Exp $"); 79__RCSID("$NetBSD: suff.c,v 1.131 2020/08/29 10:41:12 rillig Exp $");
80#endif 80#endif
81#endif /* not lint */ 81#endif /* not lint */
82#endif 82#endif
83 83
84/*- 84/*-
85 * suff.c -- 85 * suff.c --
86 * Functions to maintain suffix lists and find implicit dependents 86 * Functions to maintain suffix lists and find implicit dependents
87 * using suffix transformation rules 87 * using suffix transformation rules
88 * 88 *
89 * Interface: 89 * Interface:
90 * Suff_Init Initialize all things to do with suffixes. 90 * Suff_Init Initialize all things to do with suffixes.
91 * 91 *
92 * Suff_End Cleanup the module 92 * Suff_End Cleanup the module
@@ -538,27 +538,27 @@ SuffParseTransform(char *str, Suff **src @@ -538,27 +538,27 @@ SuffParseTransform(char *str, Suff **src
538 srcLn = NULL; 538 srcLn = NULL;
539 singleLn = NULL; 539 singleLn = NULL;
540 540
541 /* 541 /*
542 * Loop looking first for a suffix that matches the start of the 542 * Loop looking first for a suffix that matches the start of the
543 * string and then for one that exactly matches the rest of it. If 543 * string and then for one that exactly matches the rest of it. If
544 * we can find two that meet these criteria, we've successfully 544 * we can find two that meet these criteria, we've successfully
545 * parsed the string. 545 * parsed the string.
546 */ 546 */
547 for (;;) { 547 for (;;) {
548 if (srcLn == NULL) { 548 if (srcLn == NULL) {
549 srcLn = Lst_Find(sufflist, SuffSuffIsPrefix, str); 549 srcLn = Lst_Find(sufflist, SuffSuffIsPrefix, str);
550 } else { 550 } else {
551 srcLn = Lst_FindFrom(sufflist, Lst_Succ(srcLn), 551 srcLn = Lst_FindFrom(sufflist, LstNode_Next(srcLn),
552 SuffSuffIsPrefix, str); 552 SuffSuffIsPrefix, str);
553 } 553 }
554 if (srcLn == NULL) { 554 if (srcLn == NULL) {
555 /* 555 /*
556 * Ran out of source suffixes -- no such rule 556 * Ran out of source suffixes -- no such rule
557 */ 557 */
558 if (singleLn != NULL) { 558 if (singleLn != NULL) {
559 /* 559 /*
560 * Not so fast Mr. Smith! There was a suffix that encompassed 560 * Not so fast Mr. Smith! There was a suffix that encompassed
561 * the entire string, so we assume it was a transformation 561 * the entire string, so we assume it was a transformation
562 * to the null suffix (thank you POSIX). We still prefer to 562 * to the null suffix (thank you POSIX). We still prefer to
563 * find a double rule over a singleton, hence we leave this 563 * find a double rule over a singleton, hence we leave this
564 * check until the end. 564 * check until the end.
@@ -1566,27 +1566,27 @@ SuffExpandChildren(LstNode cln, GNode *p @@ -1566,27 +1566,27 @@ SuffExpandChildren(LstNode cln, GNode *p
1566 * Add all elements of the members list to the parent node. 1566 * Add all elements of the members list to the parent node.
1567 */ 1567 */
1568 while(!Lst_IsEmpty(members)) { 1568 while(!Lst_IsEmpty(members)) {
1569 gn = Lst_Dequeue(members); 1569 gn = Lst_Dequeue(members);
1570 1570
1571 if (DEBUG(SUFF)) { 1571 if (DEBUG(SUFF)) {
1572 fprintf(debug_file, "%s...", gn->name); 1572 fprintf(debug_file, "%s...", gn->name);
1573 } 1573 }
1574 /* Add gn to the parents child list before the original child */ 1574 /* Add gn to the parents child list before the original child */
1575 Lst_InsertBefore(pgn->children, cln, gn); 1575 Lst_InsertBefore(pgn->children, cln, gn);
1576 Lst_Append(gn->parents, pgn); 1576 Lst_Append(gn->parents, pgn);
1577 pgn->unmade++; 1577 pgn->unmade++;
1578 /* Expand wildcards on new node */ 1578 /* Expand wildcards on new node */
1579 SuffExpandWildcards(Lst_Prev(cln), pgn); 1579 SuffExpandWildcards(LstNode_Prev(cln), pgn);
1580 } 1580 }
1581 Lst_Free(members); 1581 Lst_Free(members);
1582 1582
1583 /* 1583 /*
1584 * Free the result 1584 * Free the result
1585 */ 1585 */
1586 free(cp); 1586 free(cp);
1587 } 1587 }
1588 if (DEBUG(SUFF)) { 1588 if (DEBUG(SUFF)) {
1589 fprintf(debug_file, "\n"); 1589 fprintf(debug_file, "\n");
1590 } 1590 }
1591 1591
1592 /* 1592 /*
@@ -1763,28 +1763,28 @@ SuffApplyTransform(GNode *tGn, GNode *sG @@ -1763,28 +1763,28 @@ SuffApplyTransform(GNode *tGn, GNode *sG
1763 /* 1763 /*
1764 * Record last child for expansion purposes 1764 * Record last child for expansion purposes
1765 */ 1765 */
1766 ln = Lst_Last(tGn->children); 1766 ln = Lst_Last(tGn->children);
1767 1767
1768 /* 1768 /*
1769 * Pass the buck to Make_HandleUse to apply the rule 1769 * Pass the buck to Make_HandleUse to apply the rule
1770 */ 1770 */
1771 (void)Make_HandleUse(gn, tGn); 1771 (void)Make_HandleUse(gn, tGn);
1772 1772
1773 /* 1773 /*
1774 * Deal with wildcards and variables in any acquired sources 1774 * Deal with wildcards and variables in any acquired sources
1775 */ 1775 */
1776 for (ln = ln != NULL ? Lst_Succ(ln) : NULL; ln != NULL; ln = nln) { 1776 for (ln = ln != NULL ? LstNode_Next(ln) : NULL; ln != NULL; ln = nln) {
1777 nln = Lst_Succ(ln); 1777 nln = LstNode_Next(ln);
1778 SuffExpandChildren(ln, tGn); 1778 SuffExpandChildren(ln, tGn);
1779 } 1779 }
1780 1780
1781 /* 1781 /*
1782 * Keep track of another parent to which this beast is transformed so 1782 * Keep track of another parent to which this beast is transformed so
1783 * the .IMPSRC variable can be set correctly for the parent. 1783 * the .IMPSRC variable can be set correctly for the parent.
1784 */ 1784 */
1785 Lst_Append(sGn->iParents, tGn); 1785 Lst_Append(sGn->iParents, tGn);
1786 1786
1787 return TRUE; 1787 return TRUE;
1788} 1788}
1789 1789
1790 1790
@@ -1879,27 +1879,27 @@ SuffFindArchiveDeps(GNode *gn, Lst slst) @@ -1879,27 +1879,27 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
1879 Var_Set(MEMBER, name, gn); 1879 Var_Set(MEMBER, name, gn);
1880 Var_Set(ARCHIVE, gn->name, gn); 1880 Var_Set(ARCHIVE, gn->name, gn);
1881 1881
1882 /* 1882 /*
1883 * Set $@ for compatibility with other makes 1883 * Set $@ for compatibility with other makes
1884 */ 1884 */
1885 Var_Set(TARGET, gn->name, gn); 1885 Var_Set(TARGET, gn->name, gn);
1886 1886
1887 /* 1887 /*
1888 * Now we've got the important local variables set, expand any sources 1888 * Now we've got the important local variables set, expand any sources
1889 * that still contain variables or wildcards in their names. 1889 * that still contain variables or wildcards in their names.
1890 */ 1890 */
1891 for (ln = Lst_First(gn->children); ln != NULL; ln = nln) { 1891 for (ln = Lst_First(gn->children); ln != NULL; ln = nln) {
1892 nln = Lst_Succ(ln); 1892 nln = LstNode_Next(ln);
1893 SuffExpandChildren(ln, gn); 1893 SuffExpandChildren(ln, gn);
1894 } 1894 }
1895 1895
1896 if (ms != NULL) { 1896 if (ms != NULL) {
1897 /* 1897 /*
1898 * Member has a known suffix, so look for a transformation rule from 1898 * Member has a known suffix, so look for a transformation rule from
1899 * it to a possible suffix of the archive. Rather than searching 1899 * it to a possible suffix of the archive. Rather than searching
1900 * through the entire list, we just look at suffixes to which the 1900 * through the entire list, we just look at suffixes to which the
1901 * member's suffix may be transformed... 1901 * member's suffix may be transformed...
1902 */ 1902 */
1903 SuffSuffGetSuffixArgs sd; /* Search string data */ 1903 SuffSuffGetSuffixArgs sd; /* Search string data */
1904 1904
1905 /* 1905 /*
@@ -2049,27 +2049,27 @@ SuffFindNormalDeps(GNode *gn, Lst slst) @@ -2049,27 +2049,27 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
2049 /* 2049 /*
2050 * Add nodes from which the target can be made 2050 * Add nodes from which the target can be made
2051 */ 2051 */
2052 SuffAddLevel(srcs, targ); 2052 SuffAddLevel(srcs, targ);
2053 2053
2054 /* 2054 /*
2055 * Record the target so we can nuke it 2055 * Record the target so we can nuke it
2056 */ 2056 */
2057 Lst_Append(targs, targ); 2057 Lst_Append(targs, targ);
2058 2058
2059 /* 2059 /*
2060 * Search from this suffix's successor... 2060 * Search from this suffix's successor...
2061 */ 2061 */
2062 ln = Lst_Succ(ln); 2062 ln = LstNode_Next(ln);
2063 } 2063 }
2064 } 2064 }
2065 2065
2066 /* 2066 /*
2067 * Handle target of unknown suffix... 2067 * Handle target of unknown suffix...
2068 */ 2068 */
2069 if (Lst_IsEmpty(targs) && suffNull != NULL) { 2069 if (Lst_IsEmpty(targs) && suffNull != NULL) {
2070 if (DEBUG(SUFF)) { 2070 if (DEBUG(SUFF)) {
2071 fprintf(debug_file, "\tNo known suffix on %s. Using .NULL suffix\n", gn->name); 2071 fprintf(debug_file, "\tNo known suffix on %s. Using .NULL suffix\n", gn->name);
2072 } 2072 }
2073 2073
2074 targ = bmake_malloc(sizeof(Src)); 2074 targ = bmake_malloc(sizeof(Src));
2075 targ->file = bmake_strdup(gn->name); 2075 targ->file = bmake_strdup(gn->name);
@@ -2128,27 +2128,27 @@ SuffFindNormalDeps(GNode *gn, Lst slst) @@ -2128,27 +2128,27 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
2128 } 2128 }
2129 } 2129 }
2130 2130
2131 Var_Set(TARGET, gn->path ? gn->path : gn->name, gn); 2131 Var_Set(TARGET, gn->path ? gn->path : gn->name, gn);
2132 2132
2133 pref = (targ != NULL) ? targ->pref : gn->name; 2133 pref = (targ != NULL) ? targ->pref : gn->name;
2134 Var_Set(PREFIX, pref, gn); 2134 Var_Set(PREFIX, pref, gn);
2135 2135
2136 /* 2136 /*
2137 * Now we've got the important local variables set, expand any sources 2137 * Now we've got the important local variables set, expand any sources
2138 * that still contain variables or wildcards in their names. 2138 * that still contain variables or wildcards in their names.
2139 */ 2139 */
2140 for (ln = Lst_First(gn->children); ln != NULL; ln = nln) { 2140 for (ln = Lst_First(gn->children); ln != NULL; ln = nln) {
2141 nln = Lst_Succ(ln); 2141 nln = LstNode_Next(ln);
2142 SuffExpandChildren(ln, gn); 2142 SuffExpandChildren(ln, gn);
2143 } 2143 }
2144 2144
2145 if (targ == NULL) { 2145 if (targ == NULL) {
2146 if (DEBUG(SUFF)) { 2146 if (DEBUG(SUFF)) {
2147 fprintf(debug_file, "\tNo valid suffix on %s\n", gn->name); 2147 fprintf(debug_file, "\tNo valid suffix on %s\n", gn->name);
2148 } 2148 }
2149 2149
2150sfnd_abort: 2150sfnd_abort:
2151 /* 2151 /*
2152 * Deal with finding the thing on the default search path. We 2152 * Deal with finding the thing on the default search path. We
2153 * always do that, not only if the node is only a source (not 2153 * always do that, not only if the node is only a source (not
2154 * on the lhs of a dependency operator or [XXX] it has neither 2154 * on the lhs of a dependency operator or [XXX] it has neither