svn commit: r309342 - head/usr.bin/indent
Pedro F. Giffuni
pfg at FreeBSD.org
Thu Dec 1 01:48:58 UTC 2016
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
More information about the svn-src-all
mailing list