Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/indent indent: remove dead code from copy_comment_wrap
details: https://anonhg.NetBSD.org/src/rev/2f0dd462fcfe
branches: trunk
changeset: 1024826:2f0dd462fcfe
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Nov 07 08:38:27 2021 +0000
description:
indent: remove dead code from copy_comment_wrap
No functional change.
diffstat:
usr.bin/indent/pr_comment.c | 55 ++++++++++++++++++--------------------------
1 files changed, 23 insertions(+), 32 deletions(-)
diffs (118 lines):
diff -r 1eb929713b4a -r 2f0dd462fcfe usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c Sun Nov 07 08:31:46 2021 +0000
+++ b/usr.bin/indent/pr_comment.c Sun Nov 07 08:38:27 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pr_comment.c,v 1.100 2021/11/07 08:31:46 rillig Exp $ */
+/* $NetBSD: pr_comment.c,v 1.101 2021/11/07 08:38:27 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.100 2021/11/07 08:31:46 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.101 2021/11/07 08:38:27 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
@@ -204,23 +204,17 @@
static void
copy_comment_wrap(int adj_max_line_length, bool break_delim)
{
- bool may_wrap = true;
ssize_t last_blank = -1; /* index of the last blank in com.buf */
for (;;) {
switch (*inp.s) {
case '\f':
- if (may_wrap) { /* in a text comment, break the line here */
- dump_line_ff();
- last_blank = -1;
- com_add_delim();
+ dump_line_ff();
+ last_blank = -1;
+ com_add_delim();
+ inp.s++;
+ while (ch_isblank(*inp.s))
inp.s++;
- while (ch_isblank(*inp.s))
- inp.s++;
- } else {
- inp_skip();
- com_add_char('\f');
- }
break;
case '\n':
@@ -234,17 +228,15 @@
}
last_blank = -1;
- if (!may_wrap || ps.next_col_1) { /* if this is a boxed comment,
- * we handle the newline */
+ if (ps.next_col_1) {
if (com.s == com.e)
com_add_char(' ');
- if (may_wrap && com.e - com.s > 3) {
+ if (com.e - com.s > 3) {
dump_line();
com_add_delim();
}
dump_line();
- if (may_wrap)
- com_add_delim();
+ com_add_delim();
} else {
ps.next_col_1 = true;
@@ -253,20 +245,19 @@
last_blank = com.e - 1 - com.buf;
}
++line_no;
- if (may_wrap) {
- bool skip_asterisk = true;
- do { /* flush any blanks and/or tabs at start of
+
+ bool skip_asterisk = true;
+ do { /* flush any blanks and/or tabs at start of
* next line */
+ inp_skip();
+ if (*inp.s == '*' && skip_asterisk) {
+ skip_asterisk = false;
inp_skip();
- if (*inp.s == '*' && skip_asterisk) {
- skip_asterisk = false;
- inp_skip();
- if (*inp.s == '/')
- goto end_of_comment;
- }
- } while (ch_isblank(*inp.s));
- } else
- inp_skip();
+ if (*inp.s == '/')
+ goto end_of_comment;
+ }
+ } while (ch_isblank(*inp.s));
+
break; /* end of case for newline */
case '*':
@@ -284,7 +275,7 @@
com_add_char(' ');
}
- if (!ch_isblank(com.e[-1]) && may_wrap)
+ if (!ch_isblank(com.e[-1]))
com_add_char(' ');
if (token.e[-1] == '*') {
com_add_char('*');
@@ -314,7 +305,7 @@
ps.next_col_1 = false;
- if (now_len <= adj_max_line_length || !may_wrap)
+ if (now_len <= adj_max_line_length)
break;
if (isspace((unsigned char)com.e[-1]))
break;
Home |
Main Index |
Thread Index |
Old Index