Module Name: src Committed By: rillig Date: Sun Nov 7 08:38:27 UTC 2021
Modified Files: src/usr.bin/indent: pr_comment.c Log Message: indent: remove dead code from copy_comment_wrap No functional change. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/usr.bin/indent/pr_comment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.100 src/usr.bin/indent/pr_comment.c:1.101 --- src/usr.bin/indent/pr_comment.c:1.100 Sun Nov 7 08:31:46 2021 +++ src/usr.bin/indent/pr_comment.c Sun Nov 7 08:38:27 2021 @@ -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 @@ static char sccsid[] = "@(#)pr_comment.c #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 @@ analyze_comment(int *p_adj_max_line_leng 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 @@ copy_comment_wrap(int adj_max_line_lengt } 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 @@ copy_comment_wrap(int adj_max_line_lengt 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 == '/') - goto end_of_comment; - } - } while (ch_isblank(*inp.s)); - } else inp_skip(); + if (*inp.s == '*' && skip_asterisk) { + skip_asterisk = false; + 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 @@ copy_comment_wrap(int adj_max_line_lengt 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 @@ copy_comment_wrap(int adj_max_line_lengt 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;