Module Name:    src
Committed By:   rillig
Date:           Fri Jan  7 09:49:43 UTC 2022

Modified Files:
        src/usr.bin/make: parse.c

Log Message:
make: clean up ParseDependencySources

It is not necessary anymore to modify the passed-in line.  It had been
necessary when the parsing function was several hundred lines long, to
avoid gotos.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.625 -r1.626 src/usr.bin/make/parse.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/parse.c
diff -u src/usr.bin/make/parse.c:1.625 src/usr.bin/make/parse.c:1.626
--- src/usr.bin/make/parse.c:1.625	Fri Jan  7 09:35:11 2022
+++ src/usr.bin/make/parse.c	Fri Jan  7 09:49:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.625 2022/01/07 09:35:11 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.626 2022/01/07 09:49:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -106,7 +106,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.625 2022/01/07 09:35:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.626 2022/01/07 09:49:43 rillig Exp $");
 
 /*
  * Structure for a file being read ("included file")
@@ -1352,7 +1352,7 @@ ParseDependencySourcesMundane(char *star
 }
 
 /*
- * In a dependency line like 'targets: sources', parse the sources.
+ * From a dependency line like 'targets: sources', parse the sources.
  *
  * See the tests depsrc-*.mk.
  */
@@ -1364,21 +1364,17 @@ ParseDependencySources(char *p, GNodeTyp
 		ParseDependencySourcesEmpty(special, *inout_paths);
 	} else if (special == SP_MFLAGS) {
 		Main_ParseArgLine(p);
-		/*
-		 * Set the initial character to a null-character so the loop
-		 * to get sources won't get anything.
-		 */
-		*p = '\0';
+		return;
 	} else if (special == SP_SHELL) {
 		if (!Job_ParseShell(p)) {
 			Parse_Error(PARSE_FATAL,
 			    "improper shell specification");
 			return;
 		}
-		*p = '\0';
+		return;
 	} else if (special == SP_NOTPARALLEL || special == SP_SINGLESHELL ||
 		   special == SP_DELETE_ON_ERROR) {
-		*p = '\0';
+		return;
 	}
 
 	/* Now go for the sources. */

Reply via email to