svn commit: r303484 - head/usr.bin/indent

Pedro F. Giffuni pfg at FreeBSD.org
Fri Jul 29 16:17:55 UTC 2016


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


More information about the svn-src-all mailing list