Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Dec 2016 01:48:56 +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: r309342 - head/usr.bin/indent
Message-ID:  <201612010148.uB11muut051386@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Thu Dec  1 01:48:56 2016
New Revision: 309342
URL: https://svnweb.freebsd.org/changeset/base/309342

Log:
  indent(1): Don't ignore newlines after comments that follow braces.
  
  indent.c has a special loop that stores tokens from between an if () and
  the next statement into a buffer. The loop ignored all newlines, but that
  resulted in not calling dump_line() when it was needed to produce the
  final line of the buffered up comment.
  
  Taken from:	 Piotr Stefaniak

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

Modified: head/usr.bin/indent/indent.c
==============================================================================
--- head/usr.bin/indent/indent.c	Thu Dec  1 01:32:13 2016	(r309341)
+++ head/usr.bin/indent/indent.c	Thu Dec  1 01:48:56 2016	(r309342)
@@ -335,8 +335,10 @@ main(int argc, char **argv)
 	    switch (type_code) {
 	    case newline:
 		++line_no;
-		if (sc_end != NULL)
-		    goto sw_buffer;	/* dump comment, if any */
+		if (sc_end != NULL) {	/* dump comment, if any */
+		    *sc_end++ = '\n';	/* newlines are needed in this case */
+		    goto sw_buffer;
+		}
 		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?201612010148.uB11muut051386>