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 ForReadMore
details: https://anonhg.NetBSD.org/src/rev/6375f7506e1b
branches: trunk
changeset: 948761:6375f7506e1b
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Dec 31 03:19:00 2020 +0000
description:
make(1): clean up ForReadMore
After the previous clean up in for.c 1.123 from 2020-12-30, GCC 5.5 did
not inline the function SubstVarLong anymore since it was now called
from 2 places. GCC didn't notice that the function call was essentially
the same since in differed only in the end character.
By combining the cases for ${V} and $(V), the code becomes even shorter
than before, while still being understandable.
diffstat:
usr.bin/make/for.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diffs (36 lines):
diff -r 2cfacbffa0ed -r 6375f7506e1b usr.bin/make/for.c
--- a/usr.bin/make/for.c Thu Dec 31 03:10:29 2020 +0000
+++ b/usr.bin/make/for.c Thu Dec 31 03:19:00 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: for.c,v 1.124 2020/12/31 03:10:29 rillig Exp $ */
+/* $NetBSD: for.c,v 1.125 2020/12/31 03:19:00 rillig Exp $ */
/*
* Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
#include "make.h"
/* "@(#)for.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: for.c,v 1.124 2020/12/31 03:10:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.125 2020/12/31 03:19:00 rillig Exp $");
static int forLevel = 0; /* Nesting level */
@@ -459,13 +459,11 @@
mark = Buf_GetAll(&f->body, NULL);
body_end = mark + Buf_Len(&f->body);
for (p = mark; (p = strchr(p, '$')) != NULL;) {
- if (p[1] == '{') {
+ char ch = p[1];
+ if (ch == '{' || ch == '(') {
p += 2;
- SubstVarLong(f, &p, &mark, '}');
- } else if (p[1] == '(') {
- p += 2;
- SubstVarLong(f, &p, &mark, ')');
- } else if (p[1] != '\0') {
+ SubstVarLong(f, &p, &mark, ch == '{' ? '}' : ')');
+ } else if (ch != '\0') {
p++;
SubstVarShort(f, &p, &mark);
} else
Home |
Main Index |
Thread Index |
Old Index