Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make off-by-one



details:   https://anonhg.NetBSD.org/src/rev/e2a4aaefb072
branches:  trunk
changeset: 782455:e2a4aaefb072
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Nov 03 13:59:27 2012 +0000

description:
off-by-one

diffstat:

 usr.bin/make/cond.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (56 lines):

diff -r 1850eebebe62 -r e2a4aaefb072 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Sat Nov 03 13:34:08 2012 +0000
+++ b/usr.bin/make/cond.c       Sat Nov 03 13:59:27 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.66 2012/11/03 04:51:17 pgoyette Exp $       */
+/*     $NetBSD: cond.c,v 1.67 2012/11/03 13:59:27 christos Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.66 2012/11/03 04:51:17 pgoyette Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.67 2012/11/03 13:59:27 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.66 2012/11/03 04:51:17 pgoyette Exp $");
+__RCSID("$NetBSD: cond.c,v 1.67 2012/11/03 13:59:27 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1227,8 +1227,8 @@
 int
 Cond_Eval(char *line)
 {
-    #define        MAXIF      128      /* maximum depth of .if'ing */
-    #define        MAXIF_BUMP  32      /* how much to grow by */
+#define            MAXIF      128      /* maximum depth of .if'ing */
+#define            MAXIF_BUMP  32      /* how much to grow by */
     enum if_states {
        IF_ACTIVE,              /* .if or .elif part active */
        ELSE_ACTIVE,            /* .else part active */
@@ -1339,15 +1339,15 @@
        }
     } else {
        /* Normal .if */
-       if (cond_depth >= max_if_depth) {
+       if (cond_depth + 1 >= max_if_depth) {
            /*
             * This is rare, but not impossible.
             * In meta mode, dirdeps.mk (only runs at level 0)
             * can need more than the default.
             */
            max_if_depth += MAXIF_BUMP;
-           cond_state = bmake_realloc(cond_state,
-                               max_if_depth * sizeof(*cond_state));
+           cond_state = bmake_realloc(cond_state, max_if_depth *
+               sizeof(*cond_state));
        }
        state = cond_state[cond_depth];
        cond_depth++;



Home | Main Index | Thread Index | Old Index