svn commit: r321382 - in head/usr.bin/indent: . tests

Piotr Pawel Stefaniak pstef at FreeBSD.org
Sun Jul 23 14:33:05 UTC 2017


Author: pstef
Date: Sun Jul 23 14:33:04 2017
New Revision: 321382
URL: https://svnweb.freebsd.org/changeset/base/321382

Log:
  indent(1): don't produce unnecessary blank lines.
  
  Don't force a blank line between an opening brace and a block comment -- not
  even if -bbb (blank lines before block comments) is on.

Added:
  head/usr.bin/indent/tests/comments.pro   (contents, props changed)
Modified:
  head/usr.bin/indent/pr_comment.c

Modified: head/usr.bin/indent/pr_comment.c
==============================================================================
--- head/usr.bin/indent/pr_comment.c	Sun Jul 23 14:04:45 2017	(r321381)
+++ head/usr.bin/indent/pr_comment.c	Sun Jul 23 14:33:04 2017	(r321382)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include <stdlib.h>
 #include <string.h>
 #include "indent_globs.h"
+#include "indent_codes.h"
 #include "indent.h"
 /*
  * NAME:
@@ -187,7 +188,7 @@ pr_comment(void)
 	char       *t = e_com;
 	e_com = s_com + 2;
 	*e_com = 0;
-	if (blanklines_before_blockcomments)
+	if (blanklines_before_blockcomments && ps.last_token != lbrace)
 	    prefix_blankline_requested = 1;
 	dump_line();
 	e_com = s_com = t;

Added: head/usr.bin/indent/tests/comments.pro
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/indent/tests/comments.pro	Sun Jul 23 14:33:04 2017	(r321382)
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+-bbb


More information about the svn-src-head mailing list