indent(1): move case_indent from parser state to the options struct

This was missed in r334927.
This commit is contained in:
Piotr Pawel Stefaniak 2018-07-15 21:04:21 +00:00
parent 10b803a40d
commit 89463812e3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336318
3 changed files with 7 additions and 7 deletions

View File

@ -255,7 +255,7 @@ set_defaults(void)
* Because ps.case_indent is a float, we can't initialize it from the
* table:
*/
ps.case_indent = 0.0; /* -cli0.0 */
opt.case_indent = 0.0; /* -cli0.0 */
for (p = pro; p->p_name; p++)
if (p->p_type != PRO_SPECIAL)
*p->p_obj = p->p_default;
@ -284,7 +284,7 @@ set_option(char *arg)
case CLI:
if (*param_start == 0)
goto need_param;
ps.case_indent = atof(param_start);
opt.case_indent = atof(param_start);
break;
case STDIN:

View File

@ -165,6 +165,8 @@ struct options {
int cuddle_else; /* true if else should cuddle up to '}' */
int continuation_indent; /* set to the indentation between the
* edge of code and continuation lines */
float case_indent; /* The distance to indent case labels from the
* switch statement */
int com_ind; /* the column in which comments to the right
* of code should start */
int decl_indent; /* column to indent declared identifiers to */
@ -304,8 +306,6 @@ struct parser_state {
* ignored in some cases.) */
int keyword; /* the type of a keyword or 0 */
int dumped_decl_indent;
float case_indent; /* The distance to indent case labels from the
* switch statement */
int in_parameter_declaration;
int tos; /* pointer to top of stack */
char procname[100]; /* The name of the current procedure */

View File

@ -128,7 +128,7 @@ parse(int tk) /* tk: the code for the construct scanned */
/*
* it is a group as part of a while, for, etc.
*/
if (ps.p_stack[ps.tos] == swstmt && ps.case_indent >= 1)
if (ps.p_stack[ps.tos] == swstmt && opt.case_indent >= 1)
--ps.ind_level;
/*
* for a switch, brace should be two levels out from the code
@ -189,10 +189,10 @@ parse(int tk) /* tk: the code for the construct scanned */
ps.cstk[ps.tos] = case_ind;
/* save current case indent level */
ps.il[ps.tos] = ps.i_l_follow;
case_ind = ps.i_l_follow + ps.case_indent; /* cases should be one
case_ind = ps.i_l_follow + opt.case_indent; /* cases should be one
* level down from
* switch */
ps.i_l_follow += ps.case_indent + 1; /* statements should be two
ps.i_l_follow += opt.case_indent + 1; /* statements should be two
* levels in */
ps.search_brace = opt.btype_2;
break;