Module Name:    src
Committed By:   rillig
Date:           Sun Mar 14 17:38:24 UTC 2021

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

Log Message:
make: eliminate common subexpression in ApplyModifier_Remember

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.868 -r1.869 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.868 src/usr.bin/make/var.c:1.869
--- src/usr.bin/make/var.c:1.868	Sun Mar 14 17:34:50 2021
+++ src/usr.bin/make/var.c	Sun Mar 14 17:38:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.868 2021/03/14 17:34:50 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.869 2021/03/14 17:38:24 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.868 2021/03/14 17:34:50 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.869 2021/03/14 17:38:24 rillig Exp $");
 
 typedef enum VarFlags {
 	VFL_NONE	= 0,
@@ -3430,9 +3430,10 @@ ApplyModifier_Remember(const char **pp, 
 		 * behavior defined in ParseModifierPart.  This creates an
 		 * unnecessary, undocumented inconsistency in make.
 		 */
-		size_t n = strcspn(mod + 2, ":)}");
-		*pp = mod + 2 + n;
-		name = FStr_InitOwn(bmake_strldup(mod + 2, n));
+		const char *arg = mod + 2;
+		size_t argLen = strcspn(arg, ":)}");
+		*pp = arg + argLen;
+		name = FStr_InitOwn(bmake_strldup(arg, argLen));
 	} else
 		*pp = mod + 1;
 

Reply via email to