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

This commit is contained in:
Piotr Pawel Stefaniak 2018-06-03 18:29:20 +00:00
parent 9de29bfb5a
commit 370d0cf9be

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 {