indent(1): fix regression introduced in r303596.

Multi-line comments are always block comments in KNF. Restore properly,
handling the case when a long one-liner gets wrapped and becomes a
multi-line comment.

Obtained from:	Piotr Stefaniak
This commit is contained in:
Pedro F. Giffuni 2016-11-27 20:30:09 +00:00
parent 743210efd6
commit 6daffe6ebf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=309219

View File

@ -162,15 +162,19 @@ pr_comment(void)
if (*buf_ptr != ' ' && !ps.box_com)
*e_com++ = ' ';
/* Don't put a break delimiter if this comment is a one-liner */
for (t_ptr = buf_ptr; *t_ptr != '\0' && *t_ptr != '\n'; t_ptr++) {
if (t_ptr >= buf_end)
fill_buffer();
if (t_ptr[0] == '*' && t_ptr[1] == '/') {
break_delim = false;
break;
/*
* Don't put a break delimiter if this is a one-liner that won't wrap.
*/
if (break_delim)
for (t_ptr = buf_ptr; *t_ptr != '\0' && *t_ptr != '\n'; t_ptr++) {
if (t_ptr >= buf_end)
fill_buffer();
if (t_ptr[0] == '*' && t_ptr[1] == '/') {
if (adj_max_col >= count_spaces_until(ps.com_col, buf_ptr, t_ptr + 2))
break_delim = false;
break;
}
}
}
if (break_delim) {
char *t = e_com;