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): remove dead store in ParseGetLine



details:   https://anonhg.NetBSD.org/src/rev/ff56bc5d1adc
branches:  trunk
changeset: 940106:ff56bc5d1adc
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 03 21:43:41 2020 +0000

description:
make(1): remove dead store in ParseGetLine

GCC 5 didn't dare to optimize this by itself.

diffstat:

 usr.bin/make/parse.c |  19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diffs (87 lines):

diff -r f751883f62ea -r ff56bc5d1adc usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Oct 03 21:23:42 2020 +0000
+++ b/usr.bin/make/parse.c      Sat Oct 03 21:43:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.346 2020/10/03 21:23:42 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.347 2020/10/03 21:43:41 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -132,7 +132,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.346 2020/10/03 21:23:42 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.347 2020/10/03 21:43:41 rillig Exp $");
 
 /* types and constants */
 
@@ -2520,7 +2520,7 @@
 #define PARSE_SKIP 2
 
 static char *
-ParseGetLine(int flags, int *length)
+ParseGetLine(int flags)
 {
     IFile *cf = curFile;
     char *ptr;
@@ -2612,7 +2612,6 @@
 
        if (flags & PARSE_RAW) {
            /* Leave '\' (etc) in line buffer (eg 'for' lines) */
-           *length = line_end - line;
            return line;
        }
 
@@ -2632,10 +2631,8 @@
     }
 
     /* If we didn't see a '\\' then the in-situ data is fine */
-    if (escaped == NULL) {
-       *length = line_end - line;
+    if (escaped == NULL)
        return line;
-    }
 
     /* Remove escapes from '\n' and '#' */
     tp = ptr = escaped;
@@ -2678,7 +2675,6 @@
        tp--;
 
     *tp = 0;
-    *length = tp - line;
     return line;
 }
 
@@ -2694,12 +2690,11 @@
 ParseReadLine(void)
 {
     char *line;                        /* Result */
-    int lineLength;            /* Length of result */
     int lineno;                        /* Saved line # */
     int rval;
 
     for (;;) {
-       line = ParseGetLine(0, &lineLength);
+       line = ParseGetLine(0);
        if (line == NULL)
            return NULL;
 
@@ -2714,7 +2709,7 @@
        case COND_SKIP:
            /* Skip to next conditional that evaluates to COND_PARSE.  */
            do {
-               line = ParseGetLine(PARSE_SKIP, &lineLength);
+               line = ParseGetLine(PARSE_SKIP);
            } while (line && Cond_EvalLine(line) != COND_PARSE);
            if (line == NULL)
                break;
@@ -2734,7 +2729,7 @@
            lineno = curFile->lineno;
            /* Accumulate loop lines until matching .endfor */
            do {
-               line = ParseGetLine(PARSE_RAW, &lineLength);
+               line = ParseGetLine(PARSE_RAW);
                if (line == NULL) {
                    Parse_Error(PARSE_FATAL,
                             "Unexpected end of file in for loop.");



Home | Main Index | Thread Index | Old Index