Module Name: src
Committed By: rillig
Date: Fri Dec 18 23:18:08 UTC 2020
Modified Files:
src/usr.bin/make: parse.c
Log Message:
make(1): clean up UnescapeBackslash
To generate a diff of this commit:
cvs rdiff -u -r1.486 -r1.487 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.486 src/usr.bin/make/parse.c:1.487
--- src/usr.bin/make/parse.c:1.486 Fri Dec 18 23:13:45 2020
+++ src/usr.bin/make/parse.c Fri Dec 18 23:18:08 2020
@@ -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 @@ ParseEOF(void)
}
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 @@ UnescapeBackslash(char **out_tp, char **
*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 @@ ParseGetLine(GetLineMode mode)
return line;
/* Remove escapes from '\n' and '#' */
- UnescapeBackslash(&tp, &escaped, line);
-
- TrimRight(&tp, escaped);
+ UnescapeBackslash(&tp, escaped, line);
return line;
}