From 4346d4cd61ec6ab69cc92e051b7d5e69d86bd9e7 Mon Sep 17 00:00:00 2001 From: pstef Date: Mon, 4 Jun 2018 20:39:58 +0000 Subject: [PATCH] indent(1): remove the STACKSIZE macro and all of its use It conflicts with a system-provided macro of the same name on another OS. --- usr.bin/indent/indent_globs.h | 8 +++----- usr.bin/indent/parse.c | 4 +++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/usr.bin/indent/indent_globs.h b/usr.bin/indent/indent_globs.h index 5ea00f098db7..b43c79f8edf8 100644 --- a/usr.bin/indent/indent_globs.h +++ b/usr.bin/indent/indent_globs.h @@ -219,13 +219,11 @@ int auto_typedefs; /* set true to recognize identifiers int space_after_cast; /* "b = (int) a" vs "b = (int)a" */ int tabsize; /* the size of a tab */ -#define STACKSIZE 256 - struct parser_state { int last_token; - int p_stack[STACKSIZE]; /* this is the parsers stack */ - int il[STACKSIZE]; /* this stack stores indentation levels */ - float cstk[STACKSIZE];/* used to store case stmt indentation levels */ + int p_stack[256]; /* this is the parsers stack */ + int il[64]; /* this stack stores indentation levels */ + float cstk[32]; /* used to store case stmt indentation levels */ int box_com; /* set to true when we are in a "boxed" * comment. In that case, the first non-blank * char should be lined up with the / in / followed by * */ diff --git a/usr.bin/indent/parse.c b/usr.bin/indent/parse.c index c53b4447ac6d..f5a749ef5aac 100644 --- a/usr.bin/indent/parse.c +++ b/usr.bin/indent/parse.c @@ -42,10 +42,12 @@ static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/6/93"; #endif #include +#include __FBSDID("$FreeBSD$"); #include #include + #include "indent_globs.h" #include "indent_codes.h" #include "indent.h" @@ -209,7 +211,7 @@ parse(int tk) /* tk: the code for the construct scanned */ } /* end of switch */ - if (ps.tos >= STACKSIZE - 1) + if (ps.tos >= nitems(ps.p_stack) - 1) errx(1, "Parser stack overflow"); reduce(); /* see if any reduction can be done */