indent(1): revert r334640 and r334632
While STACKSIZE macro is indeed problematic on some systems, the commits were wrong to shrink il[] and cstk[], because they need to be of the same size as p_stack[] as they're accessed with the same index ps.tos.
This commit is contained in:
parent
9488993b1d
commit
0dee472dd2
@ -234,11 +234,13 @@ int inhibit_formatting; /* true if INDENT OFF is in effect */
|
||||
int suppress_blanklines;/* set iff following blanklines should be
|
||||
* suppressed */
|
||||
|
||||
#define STACKSIZE 256
|
||||
|
||||
struct parser_state {
|
||||
int last_token;
|
||||
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 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 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 * */
|
||||
|
@ -42,12 +42,10 @@ static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/param.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "indent_globs.h"
|
||||
#include "indent_codes.h"
|
||||
#include "indent.h"
|
||||
@ -211,7 +209,7 @@ parse(int tk) /* tk: the code for the construct scanned */
|
||||
|
||||
} /* end of switch */
|
||||
|
||||
if (ps.tos >= (int)nitems(ps.p_stack) - 1)
|
||||
if (ps.tos >= STACKSIZE - 1)
|
||||
errx(1, "Parser stack overflow");
|
||||
|
||||
reduce(); /* see if any reduction can be done */
|
||||
|
Loading…
x
Reference in New Issue
Block a user