Date: Sun, 27 Nov 2016 20:30:09 +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: r309219 - head/usr.bin/indent Message-ID: <201611272030.uARKU9jY073711@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Sun Nov 27 20:30:09 2016 New Revision: 309219 URL: https://svnweb.freebsd.org/changeset/base/309219 Log: 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 Modified: head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/pr_comment.c ============================================================================== --- head/usr.bin/indent/pr_comment.c Sun Nov 27 20:21:38 2016 (r309218) +++ head/usr.bin/indent/pr_comment.c Sun Nov 27 20:30:09 2016 (r309219) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611272030.uARKU9jY073711>