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: eliminate a few common subexpressions
details: https://anonhg.NetBSD.org/src/rev/88e209499ea7
branches: trunk
changeset: 985849:88e209499ea7
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Sep 11 09:16:14 2021 +0000
description:
make: eliminate a few common subexpressions
This commit contains only changes that don't increase the code size on
x86_64. Replacing the remaining instance of ModChain_ShouldEval would
either increase the code size or make the code harder to understand.
No functional change.
diffstat:
usr.bin/make/var.c | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
diffs (97 lines):
diff -r 52ccf8b9bd53 -r 88e209499ea7 usr.bin/make/var.c
--- a/usr.bin/make/var.c Sat Sep 11 08:34:24 2021 +0000
+++ b/usr.bin/make/var.c Sat Sep 11 09:16:14 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.949 2021/09/06 19:38:30 rillig Exp $ */
+/* $NetBSD: var.c,v 1.950 2021/09/11 09:16:14 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.949 2021/09/06 19:38:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.950 2021/09/11 09:16:14 rillig Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@@ -2564,6 +2564,7 @@
static ApplyModifierResult
ApplyModifier_Gmtime(const char **pp, ModChain *ch)
{
+ Expr *expr;
time_t utc;
const char *mod = *pp;
@@ -2583,9 +2584,10 @@
*pp = mod + 6;
}
- if (ModChain_ShouldEval(ch))
- Expr_SetValueOwn(ch->expr,
- VarStrftime(ch->expr->value.str, true, utc));
+ expr = ch->expr;
+ if (Expr_ShouldEval(expr))
+ Expr_SetValueOwn(expr,
+ VarStrftime(expr->value.str, true, utc));
return AMR_OK;
}
@@ -2594,6 +2596,7 @@
static ApplyModifierResult
ApplyModifier_Localtime(const char **pp, ModChain *ch)
{
+ Expr *expr;
time_t utc;
const char *mod = *pp;
@@ -2613,9 +2616,10 @@
*pp = mod + 9;
}
- if (ModChain_ShouldEval(ch))
- Expr_SetValueOwn(ch->expr,
- VarStrftime(ch->expr->value.str, false, utc));
+ expr = ch->expr;
+ if (Expr_ShouldEval(expr))
+ Expr_SetValueOwn(expr,
+ VarStrftime(expr->value.str, false, utc));
return AMR_OK;
}
@@ -2644,7 +2648,7 @@
(*pp)++;
- if (!ModChain_ShouldEval(ch))
+ if (!Expr_ShouldEval(expr))
return AMR_OK;
Expr_Define(expr);
@@ -3149,14 +3153,14 @@
if (mod[1] == 'u') { /* :tu */
*pp = mod + 2;
- if (ModChain_ShouldEval(ch))
+ if (Expr_ShouldEval(expr))
Expr_SetValueOwn(expr, str_toupper(expr->value.str));
return AMR_OK;
}
if (mod[1] == 'l') { /* :tl */
*pp = mod + 2;
- if (ModChain_ShouldEval(ch))
+ if (Expr_ShouldEval(expr))
Expr_SetValueOwn(expr, str_tolower(expr->value.str));
return AMR_OK;
}
@@ -3443,7 +3447,7 @@
return AMR_CLEANUP;
}
- if (!ModChain_ShouldEval(ch)) {
+ if (!Expr_ShouldEval(expr)) {
FStr_Done(&then_expr);
FStr_Done(&else_expr);
} else if (value) {
Home |
Main Index |
Thread Index |
Old Index