From owner-svn-src-head@freebsd.org Sun Jun 3 16:27:41 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 166A2FDB682; Sun, 3 Jun 2018 16:27:41 +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 C0EF76D852; Sun, 3 Jun 2018 16:27:40 +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 A22AE21027; Sun, 3 Jun 2018 16:27:40 +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 w53GRerG081524; Sun, 3 Jun 2018 16:27:40 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w53GRebs081523; Sun, 3 Jun 2018 16:27:40 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201806031627.w53GRebs081523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Sun, 3 Jun 2018 16:27:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334565 - 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: 334565 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.26 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, 03 Jun 2018 16:27:41 -0000 Author: pstef Date: Sun Jun 3 16:27:40 2018 New Revision: 334565 URL: https://svnweb.freebsd.org/changeset/base/334565 Log: indent(1): remove is_procname. It was a shorthand for checking if ps.procname is a non-empty string; the same can be done with ps.procname[0] which avoids the need for updating is_procname after every call to lexi(). Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Sun Jun 3 16:21:15 2018 (r334564) +++ head/usr.bin/indent/indent.c Sun Jun 3 16:27:40 2018 (r334565) @@ -322,13 +322,11 @@ main(int argc, char **argv) while (1) { /* this is the main loop. it will go until we * reach eof */ - int is_procname; int comment_buffered = false; type_code = lexi(&ps); /* lexi reads one token. The actual * characters read are stored in "token". lexi * returns a code indicating the type of token */ - is_procname = ps.procname[0]; /* * The following code moves newlines and comments following an if (), @@ -596,7 +594,7 @@ check_type: ps.p_l_follow--; } if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent && - !is_procname && ps.paren_level == 0) { + ps.procname[0] == '\0' && ps.paren_level == 0) { /* function pointer declarations */ if (troff) { sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); @@ -672,8 +670,8 @@ check_type: break; case unary_op: /* this could be any unary operation */ - if (!ps.dumped_decl_indent && ps.in_decl && !is_procname && - !ps.block_init && ps.paren_level == 0) { + if (!ps.dumped_decl_indent && ps.in_decl && !ps.block_init && + ps.procname[0] == '\0' && ps.paren_level == 0) { /* pointer declarations */ if (troff) { if (ps.want_blank) @@ -1105,7 +1103,7 @@ check_type: ps.want_blank = (s_code != e_code); /* only put blank after comma * if comma does not start the * line */ - if (ps.in_decl && is_procname == 0 && !ps.block_init && + if (ps.in_decl && ps.procname[0] == '\0' && !ps.block_init && !ps.dumped_decl_indent && ps.paren_level == 0) { /* indent leading commas and not the actual identifiers */ indent_declaration(dec_ind - 1, tabs_to_var);