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): simplify termination condition for .fo...



details:   https://anonhg.NetBSD.org/src/rev/6736a962bb2a
branches:  trunk
changeset: 1017547:6736a962bb2a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Dec 31 03:10:29 2020 +0000

description:
make(1): simplify termination condition for .for loop

At this point, the number of iteration items is always a multiple of the
number of iteration variables, which makes any addition more complicated
than absolutely necessary.

diffstat:

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

diffs (27 lines):

diff -r 74c22f1b29c9 -r 6736a962bb2a usr.bin/make/for.c
--- a/usr.bin/make/for.c        Thu Dec 31 03:05:12 2020 +0000
+++ b/usr.bin/make/for.c        Thu Dec 31 03:10:29 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.123 2020/12/30 14:28:32 rillig Exp $ */
+/*     $NetBSD: for.c,v 1.124 2020/12/31 03:10:29 rillig Exp $ */
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
 #include "make.h"
 
 /*     "@(#)for.c      8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: for.c,v 1.123 2020/12/30 14:28:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.124 2020/12/31 03:10:29 rillig Exp $");
 
 static int forLevel = 0;       /* Nesting level */
 
@@ -448,7 +448,7 @@
        const char *body_end;
        char *cmds_str;
 
-       if (f->sub_next + f->vars.len > f->items.len) {
+       if (f->sub_next == f->items.len) {
                /* No more iterations */
                For_Free(f);
                return NULL;



Home | Main Index | Thread Index | Old Index