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: clean up ParseDependencySources



details:   https://anonhg.NetBSD.org/src/rev/f75fbd6176f4
branches:  trunk
changeset: 359474:f75fbd6176f4
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jan 07 09:49:43 2022 +0000

description:
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.

diffstat:

 usr.bin/make/parse.c |  16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diffs (52 lines):

diff -r 2b40dff45da7 -r f75fbd6176f4 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Fri Jan 07 09:35:11 2022 +0000
+++ b/usr.bin/make/parse.c      Fri Jan 07 09:49:43 2022 +0000
@@ -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 @@
 }
 
 /*
- * 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 @@
                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. */



Home | Main Index | Thread Index | Old Index