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(1): extract ApplyModifier_Literal into sep...



details:   https://anonhg.NetBSD.org/src/rev/6b23a0c5598d
branches:  trunk
changeset: 976755:6b23a0c5598d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 03 12:51:49 2020 +0000

description:
make(1): extract ApplyModifier_Literal into separate function

diffstat:

 usr.bin/make/var.c |  19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r 0c39b140c215 -r 6b23a0c5598d usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Oct 03 12:46:52 2020 +0000
+++ b/usr.bin/make/var.c        Sat Oct 03 12:51:49 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.561 2020/10/03 12:46:52 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.562 2020/10/03 12:51:49 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include    "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.561 2020/10/03 12:46:52 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.562 2020/10/03 12:51:49 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -2065,6 +2065,16 @@
     return AMR_OK;
 }
 
+/* :L */
+static ApplyModifierResult
+ApplyModifier_Literal(const char **pp, ApplyModifiersState *st)
+{
+    ApplyModifiersState_Define(st);
+    st->newVal = bmake_strdup(st->v->name);
+    (*pp)++;
+    return AMR_OK;
+}
+
 /* :gmtime */
 static ApplyModifierResult
 ApplyModifier_Gmtime(const char **pp, ApplyModifiersState *st)
@@ -3076,10 +3086,7 @@
     case 'U':
        return ApplyModifier_Defined(pp, st);
     case 'L':
-       ApplyModifiersState_Define(st);
-       st->newVal = bmake_strdup(st->v->name);
-       (*pp)++;
-       return AMR_OK;
+        return ApplyModifier_Literal(pp, st);
     case 'P':
        return ApplyModifier_Path(pp, st);
     case '!':



Home | Main Index | Thread Index | Old Index