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): clean up UnescapeBackslash



details:   https://anonhg.NetBSD.org/src/rev/2ebd9cdb4a9c
branches:  trunk
changeset: 979175:2ebd9cdb4a9c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Dec 18 23:18:08 2020 +0000

description:
make(1): clean up UnescapeBackslash

diffstat:

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

diffs (66 lines):

diff -r ff03164819b4 -r 2ebd9cdb4a9c usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Fri Dec 18 23:13:45 2020 +0000
+++ b/usr.bin/make/parse.c      Fri Dec 18 23:18:08 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.486 2020/12/18 23:13:45 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.487 2020/12/18 23:18:08 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.486 2020/12/18 23:13:45 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.487 2020/12/18 23:18:08 rillig Exp $");
 
 /* types and constants */
 
@@ -2657,10 +2657,9 @@
 }
 
 static void
-UnescapeBackslash(char **out_tp, char **inout_escaped,
-                 char *const line) {
+UnescapeBackslash(char **out_tp, char *escaped, char *const line)
+{
        char *tp, *ptr;
-       char *escaped = *inout_escaped;
 
        tp = ptr = escaped;
        escaped = line;
@@ -2707,21 +2706,12 @@
                *tp++ = ch;
        }
 
-       *out_tp = tp;
-       *inout_escaped = escaped;
-}
-
-/* Delete any trailing spaces - eg from empty continuations */
-static void
-TrimRight(char **inout_tp, const char * const escaped)
-{
-       char *tp = *inout_tp;
-
+       /* Delete any trailing spaces - eg from empty continuations */
        while (tp > escaped && ch_isspace(tp[-1]))
                tp--;
        *tp = '\0';
 
-       *inout_tp = tp;
+       *out_tp = tp;
 }
 
 typedef enum GetLineMode {
@@ -2841,9 +2831,7 @@
                return line;
 
        /* Remove escapes from '\n' and '#' */
-       UnescapeBackslash(&tp, &escaped, line);
-
-       TrimRight(&tp, escaped);
+       UnescapeBackslash(&tp, escaped, line);
 
        return line;
 }



Home | Main Index | Thread Index | Old Index