Module Name: src
Committed By: rillig
Date: Wed Feb 9 21:32:38 UTC 2022
Modified Files:
src/usr.bin/make: var.c
Log Message:
make: simplify control flow in ModifyWord_SysVSubst
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.1010 -r1.1011 src/usr.bin/make/var.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/var.c
diff -u src/usr.bin/make/var.c:1.1010 src/usr.bin/make/var.c:1.1011
--- src/usr.bin/make/var.c:1.1010 Wed Feb 9 21:03:13 2022
+++ src/usr.bin/make/var.c Wed Feb 9 21:32:38 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.1010 2022/02/09 21:03:13 rillig Exp $ */
+/* $NetBSD: var.c,v 1.1011 2022/02/09 21:32:38 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1010 2022/02/09 21:03:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1011 2022/02/09 21:32:38 rillig Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@@ -1430,10 +1430,11 @@ ModifyWord_SysVSubst(Substring word, Sep
if (Substring_IsEmpty(word))
return;
- if (!Substring_HasPrefix(word, args->lhsPrefix))
- goto no_match;
- if (!Substring_HasSuffix(word, args->lhsSuffix))
- goto no_match;
+ if (!Substring_HasPrefix(word, args->lhsPrefix) ||
+ !Substring_HasSuffix(word, args->lhsSuffix)) {
+ SepBuf_AddSubstring(buf, word);
+ return;
+ }
rhs = FStr_InitRefer(args->rhs);
Var_Expand(&rhs, args->scope, VARE_WANTRES);
@@ -1449,10 +1450,6 @@ ModifyWord_SysVSubst(Substring word, Sep
SepBuf_AddStr(buf, percent != NULL ? percent + 1 : rhs.str);
FStr_Done(&rhs);
- return;
-
-no_match:
- SepBuf_AddSubstring(buf, word);
}
#endif