Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jul 2016 16:17:54 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r303484 - head/usr.bin/indent
Message-ID:  <201607291617.u6TGHsPE060673@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Fri Jul 29 16:17:54 2016
New Revision: 303484
URL: https://svnweb.freebsd.org/changeset/base/303484

Log:
  indent(1): Fix breakage caused by single comment following "else".
  
  indent(1) simply wasn't taught that "else" may be followed by a comment
  without any opening brace anywhere on the line, so it was very confused
  in such cases.
  
  Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
  Obtained from:	Piotr Stefaniak

Modified:
  head/usr.bin/indent/indent.c

Modified: head/usr.bin/indent/indent.c
==============================================================================
--- head/usr.bin/indent/indent.c	Fri Jul 29 16:14:03 2016	(r303483)
+++ head/usr.bin/indent/indent.c	Fri Jul 29 16:17:54 2016	(r303484)
@@ -319,6 +319,8 @@ main(int argc, char **argv)
 	    switch (type_code) {
 	    case newline:
 		++line_no;
+		if (sc_end != NULL)
+		    goto sw_buffer;	/* dump comment, if any */
 		flushed_nl = true;
 	    case form_feed:
 		break;		/* form feeds and newlines found here will be



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607291617.u6TGHsPE060673>