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): add comments for ModifyWord_Subst



details:   https://anonhg.NetBSD.org/src/rev/d5d22c4d603b
branches:  trunk
changeset: 943262:d5d22c4d603b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 29 12:48:17 2020 +0000

description:
make(1): add comments for ModifyWord_Subst

Without any comments, the code is unnecessarily hard to follow.

diffstat:

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

diffs (46 lines):

diff -r dd008ce726c2 -r d5d22c4d603b usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Aug 29 12:39:32 2020 +0000
+++ b/usr.bin/make/var.c        Sat Aug 29 12:48:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.475 2020/08/29 12:27:10 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.476 2020/08/29 12:48:17 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.475 2020/08/29 12:27:10 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.476 2020/08/29 12:48:17 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.475 2020/08/29 12:27:10 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.476 2020/08/29 12:48:17 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1297,9 +1297,11 @@
            if (wordLen != args->lhsLen)
                goto nosub;
 
+           /* :S,^whole$,replacement, */
            SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
            args->matched = TRUE;
        } else {
+           /* :S,^prefix,replacement, */
            SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
            SepBuf_AddBytes(buf, word + args->lhsLen, wordLen - args->lhsLen);
            args->matched = TRUE;
@@ -1317,6 +1319,7 @@
        if (memcmp(start, args->lhs, args->lhsLen) != 0)
            goto nosub;
 
+       /* :S,suffix$,replacement, */
        SepBuf_AddBytesBetween(buf, word, start);
        SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
        args->matched = TRUE;



Home | Main Index | Thread Index | Old Index