Module Name:    othersrc
Committed By:   dholland
Date:           Sat Mar 23 19:57:44 UTC 2013

Modified Files:
        othersrc/usr.bin/dholland-make2: main.c

Log Message:
Remove another linked list.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/dholland-make2/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/usr.bin/dholland-make2/main.c
diff -u othersrc/usr.bin/dholland-make2/main.c:1.9 othersrc/usr.bin/dholland-make2/main.c:1.10
--- othersrc/usr.bin/dholland-make2/main.c:1.9	Sat Mar 23 17:47:11 2013
+++ othersrc/usr.bin/dholland-make2/main.c	Sat Mar 23 19:57:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.9 2013/03/23 17:47:11 dholland Exp $	*/
+/*	$NetBSD: main.c,v 1.10 2013/03/23 19:57:44 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -128,7 +128,7 @@
 
 MAKE_COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
  The Regents of the University of California.  All rights reserved.");
-MAKE_RCSID("$NetBSD: main.c,v 1.9 2013/03/23 17:47:11 dholland Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.10 2013/03/23 19:57:44 dholland Exp $");
 
 
 #ifndef	DEFMAXLOCAL
@@ -143,7 +143,7 @@ Boolean			allPrecious;	/* .PRECIOUS give
 static Boolean		noBuiltins;	/* -r flag */
 static struct stringarray makefiles;	/* ordered list of makefiles to read */
 static Boolean		printVars;	/* print value of one or more vars */
-static Lst		variables;	/* list of variables to print */
+static struct stringarray variables;	/* list of variables to print */
 int			maxJobs;	/* -j argument */
 static int		maxJobTokens;	/* -j argument */
 Boolean			compatMake;	/* -B argument */
@@ -451,7 +451,7 @@ rearg:	
 		case 'V':
 			if (argvalue == NULL) goto noarg;
 			printVars = TRUE;
-			(void)Lst_AtEnd(variables, argvalue);
+			stringarray_add(&variables, argvalue, NULL);
 			Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
 			Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
 			break;
@@ -857,7 +857,7 @@ main(int argc, char **argv)
 	stringarray_init(&makefiles);
 	printVars = FALSE;
 	debugVflag = FALSE;
-	variables = Lst_Init(FALSE);
+	stringarray_init(&variables);
 	beSilent = FALSE;		/* Print commands as executed */
 	ignoreErrors = FALSE;		/* Pay attention to non-zero returns */
 	noExecute = FALSE;		/* Execute all commands */
@@ -1215,16 +1215,16 @@ main(int argc, char **argv)
 
 	/* print the values of any variables requested by the user */
 	if (printVars) {
-		LstNode ln;
+		unsigned i, num;
 		Boolean expandVars;
 
 		if (debugVflag)
 			expandVars = FALSE;
 		else
 			expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE);
-		for (ln = Lst_First(variables); ln != NULL;
-		    ln = Lst_Succ(ln)) {
-			char *var = (char *)Lst_Datum(ln);
+		num = stringarray_num(&variables);
+		for (i=0; i<num; i++) {
+			char *var = stringarray_get(&variables, i);
 			char *value;
 			
 			if (strchr(var, '$')) {
@@ -1288,7 +1288,8 @@ main(int argc, char **argv)
 	 */
 	glist_destroy(targs);
 
-	Lst_Destroy(variables, NULL);
+	stringarray_setsize(&variables, 0);
+	stringarray_cleanup(&variables);
 	stringarray_setsize(&makefiles, 0);
 	stringarray_cleanup(&makefiles);
 	num = stringarray_num(&create);

Reply via email to