Module Name: src
Committed By: rillig
Date: Thu Dec 31 03:33:10 UTC 2020
Modified Files:
src/usr.bin/make: for.c
Log Message:
make(1): inline variable in ForReadMore
This variable was intended to help the compilers produce efficient code
by avoiding a duplicate memory read. As it turned out, GCC 5.5 doesn't
need this help, and probably newer compilers don't need it either. Well
done, GCC, keeping track of the memory locations even if the pointer to
it changes in the middle.
To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/make/for.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/for.c
diff -u src/usr.bin/make/for.c:1.125 src/usr.bin/make/for.c:1.126
--- src/usr.bin/make/for.c:1.125 Thu Dec 31 03:19:00 2020
+++ src/usr.bin/make/for.c Thu Dec 31 03:33:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: for.c,v 1.125 2020/12/31 03:19:00 rillig Exp $ */
+/* $NetBSD: for.c,v 1.126 2020/12/31 03:33:10 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.125 2020/12/31 03:19:00 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.126 2020/12/31 03:33:10 rillig Exp $");
static int forLevel = 0; /* Nesting level */
@@ -459,11 +459,10 @@ ForReadMore(void *v_arg, size_t *out_len
mark = Buf_GetAll(&f->body, NULL);
body_end = mark + Buf_Len(&f->body);
for (p = mark; (p = strchr(p, '$')) != NULL;) {
- char ch = p[1];
- if (ch == '{' || ch == '(') {
+ if (p[1] == '{' || p[1] == '(') {
p += 2;
- SubstVarLong(f, &p, &mark, ch == '{' ? '}' : ')');
- } else if (ch != '\0') {
+ SubstVarLong(f, &p, &mark, p[-1] == '{' ? '}' : ')');
+ } else if (p[1] != '\0') {
p++;
SubstVarShort(f, &p, &mark);
} else