From owner-svn-src-all@freebsd.org Fri Jul 29 16:34:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EC28BA76E4; Fri, 29 Jul 2016 16:34:17 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 6B84E1702; Fri, 29 Jul 2016 16:34:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6TGYGOK068127; Fri, 29 Jul 2016 16:34:16 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6TGYGwA068126; Fri, 29 Jul 2016 16:34:16 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607291634.u6TGYGwA068126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 29 Jul 2016 16:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303489 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2016 16:34:17 -0000 Author: pfg Date: Fri Jul 29 16:34:16 2016 New Revision: 303489 URL: https://svnweb.freebsd.org/changeset/base/303489 Log: indent(1): Removed whitespace shouldn't be considered in column calculations. This piece of code removed tabs and space characters from after colons that follow labels by decrementing the e_lab (end of label) "pointer" which is later used to calculate the width of the string that fprintf() puts into "output". But pad_output() gets the length from the actual string, so it miscalculated what the current column is. Fixed by putting a string terminator at the e_lab "pointer". Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Obtained from: Piotr Stefaniak Modified: head/usr.bin/indent/io.c Modified: head/usr.bin/indent/io.c ============================================================================== --- head/usr.bin/indent/io.c Fri Jul 29 16:33:45 2016 (r303488) +++ head/usr.bin/indent/io.c Fri Jul 29 16:34:16 2016 (r303489) @@ -116,6 +116,7 @@ dump_line(void) } while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t')) e_lab--; + *e_lab = '\0'; cur_col = pad_output(1, compute_label_target()); if (s_lab[0] == '#' && (strncmp(s_lab, "#else", 5) == 0 || strncmp(s_lab, "#endif", 6) == 0)) {