Module Name:    src
Committed By:   rillig
Date:           Sat Oct  1 09:20:47 UTC 2022

Modified Files:
        src/usr.bin/make: var.c

Log Message:
make: merge duplicate code

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1033 -r1.1034 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.1033 src/usr.bin/make/var.c:1.1034
--- src/usr.bin/make/var.c:1.1033	Tue Sep 27 17:46:58 2022
+++ src/usr.bin/make/var.c	Sat Oct  1 09:20:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1033 2022/09/27 17:46:58 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1034 2022/10/01 09:20:47 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.1033 2022/09/27 17:46:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1034 2022/10/01 09:20:47 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -2926,11 +2926,8 @@ ApplyModifier_Regex(const char **pp, Mod
 	oneBigWord = ch->oneBigWord;
 	ParsePatternFlags(pp, &args.pflags, &oneBigWord);
 
-	if (!ModChain_ShouldEval(ch)) {
-		LazyBuf_Done(&replaceBuf);
-		FStr_Done(&re);
-		return AMR_OK;
-	}
+	if (!ModChain_ShouldEval(ch))
+		goto done;
 
 	error = regcomp(&args.re, re.str, REG_EXTENDED);
 	if (error != 0) {
@@ -2947,6 +2944,7 @@ ApplyModifier_Regex(const char **pp, Mod
 	ModifyWords(ch, ModifyWord_SubstRegex, &args, oneBigWord);
 
 	regfree(&args.re);
+done:
 	LazyBuf_Done(&replaceBuf);
 	FStr_Done(&re);
 	return AMR_OK;

Reply via email to