Module Name:    src
Committed By:   rillig
Date:           Tue Dec  7 21:30:11 UTC 2021

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

Log Message:
make: extract common code into Expr_Words

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.966 -r1.967 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.966 src/usr.bin/make/var.c:1.967
--- src/usr.bin/make/var.c:1.966	Mon Dec  6 22:07:53 2021
+++ src/usr.bin/make/var.c	Tue Dec  7 21:30:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.966 2021/12/06 22:07:53 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.967 2021/12/07 21:30:11 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.966 2021/12/06 22:07:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.967 2021/12/07 21:30:11 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -2091,6 +2091,12 @@ Expr_Str(const Expr *expr)
 	return expr->value.str;
 }
 
+static SubstringWords
+Expr_Words(const Expr *expr)
+{
+	return Substring_Words(Expr_Str(expr), false);
+}
+
 static void
 Expr_SetValue(Expr *expr, FStr value)
 {
@@ -2738,8 +2744,7 @@ ApplyModifier_Range(const char **pp, Mod
 		return AMR_OK;
 
 	if (n == 0) {
-		SubstringWords words = Substring_Words(Expr_Str(ch->expr),
-		    false);
+		SubstringWords words = Expr_Words(ch->expr);
 		n = words.len;
 		SubstringWords_Free(words);
 	}
@@ -3217,8 +3222,7 @@ ApplyModifier_Words(const char **pp, Mod
 		} else {
 			Buffer buf;
 
-			SubstringWords words = Substring_Words(
-			    Expr_Str(expr), false);
+			SubstringWords words = Expr_Words(expr);
 			size_t ac = words.len;
 			SubstringWords_Free(words);
 
@@ -3399,7 +3403,7 @@ ApplyModifier_Order(const char **pp, Mod
 	if (!ModChain_ShouldEval(ch))
 		return AMR_OK;
 
-	words = Substring_Words(Expr_Str(ch->expr), false);
+	words = Expr_Words(ch->expr);
 	if (cmp == NULL)
 		ShuffleSubstrings(words.words, words.len);
 	else {
@@ -3645,7 +3649,7 @@ ApplyModifier_Unique(const char **pp, Mo
 	if (!ModChain_ShouldEval(ch))
 		return AMR_OK;
 
-	words = Substring_Words(Expr_Str(ch->expr), false);
+	words = Expr_Words(ch->expr);
 
 	if (words.len > 1) {
 		size_t si, di;

Reply via email to