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: only access the list of included files if...



details:   https://anonhg.NetBSD.org/src/rev/b9213e31f699
branches:  trunk
changeset: 370685:b9213e31f699
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 24 16:09:04 2022 +0000

description:
make: only access the list of included files if it is non-empty

diffstat:

 usr.bin/make/parse.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r 4a643d4f7076 -r b9213e31f699 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Sep 24 15:01:54 2022 +0000
+++ b/usr.bin/make/parse.c      Sat Sep 24 16:09:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.685 2022/09/24 10:26:32 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.686 2022/09/24 16:09:04 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -105,7 +105,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.685 2022/09/24 10:26:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.686 2022/09/24 16:09:04 rillig Exp $");
 
 /*
  * A file being read.
@@ -300,6 +300,7 @@
 static IncludedFile *
 GetInclude(size_t i)
 {
+       assert(i < includes.len);
        return Vector_Get(&includes, i);
 }
 
@@ -362,11 +363,11 @@
        const IncludedFile *entries;
        size_t i, n;
 
-       entries = GetInclude(0);
        n = includes.len;
        if (n == 0)
                return;
 
+       entries = GetInclude(0);
        if (!includingInnermost && entries[n - 1].forLoop == NULL)
                n--;            /* already in the diagnostic */
 



Home | Main Index | Thread Index | Old Index