From owner-svn-src-head@freebsd.org Sun Jul 15 21:04:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82159102950F; Sun, 15 Jul 2018 21:04:22 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B714704A3; Sun, 15 Jul 2018 21:04:22 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0994A132F6; Sun, 15 Jul 2018 21:04:22 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6FL4L2n001430; Sun, 15 Jul 2018 21:04:21 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6FL4LN4001427; Sun, 15 Jul 2018 21:04:21 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201807152104.w6FL4LN4001427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Sun, 15 Jul 2018 21:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336318 - head/usr.bin/indent X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: head/usr.bin/indent X-SVN-Commit-Revision: 336318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2018 21:04:22 -0000 Author: pstef Date: Sun Jul 15 21:04:21 2018 New Revision: 336318 URL: https://svnweb.freebsd.org/changeset/base/336318 Log: indent(1): move case_indent from parser state to the options struct This was missed in r334927. Modified: head/usr.bin/indent/args.c head/usr.bin/indent/indent_globs.h head/usr.bin/indent/parse.c Modified: head/usr.bin/indent/args.c ============================================================================== --- head/usr.bin/indent/args.c Sun Jul 15 20:42:47 2018 (r336317) +++ head/usr.bin/indent/args.c Sun Jul 15 21:04:21 2018 (r336318) @@ -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 @@ found: case CLI: if (*param_start == 0) goto need_param; - ps.case_indent = atof(param_start); + opt.case_indent = atof(param_start); break; case STDIN: Modified: head/usr.bin/indent/indent_globs.h ============================================================================== --- head/usr.bin/indent/indent_globs.h Sun Jul 15 20:42:47 2018 (r336317) +++ head/usr.bin/indent/indent_globs.h Sun Jul 15 21:04:21 2018 (r336318) @@ -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 */ Modified: head/usr.bin/indent/parse.c ============================================================================== --- head/usr.bin/indent/parse.c Sun Jul 15 20:42:47 2018 (r336317) +++ head/usr.bin/indent/parse.c Sun Jul 15 21:04:21 2018 (r336318) @@ -128,7 +128,7 @@ parse(int tk) /* tk: the code for the construct scanne /* * 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 scanne 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;