indent(1): don't overflow di_stack[]

This commit is contained in:
pstef 2018-06-03 18:29:20 +00:00
parent 4522d5b3c8
commit 89e7752398

View File

@ -831,7 +831,12 @@ main(int argc, char **argv)
* with '{' */
if (ps.in_decl && ps.in_or_st) { /* this is either a structure
* declaration or an init */
di_stack[ps.dec_nest++] = dec_ind;
di_stack[ps.dec_nest] = dec_ind;
if (++ps.dec_nest == nitems(di_stack)) {
diag3(0, "Reached internal limit of %d struct levels",
nitems(di_stack));
ps.dec_nest--;
}
/* ? dec_ind = 0; */
}
else {