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/792962175ea2
branches:  trunk
changeset: 991093:792962175ea2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 07 11:08:25 2021 +0000

description:
indent: remove dead code from copy_comment_wrap

C99 comments are not wrapped, therefore there is no need to check for
them in copy_comment_wrap.

No functional change.

diffstat:

 usr.bin/indent/pr_comment.c |  16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diffs (54 lines):

diff -r 0d33665190ab -r 792962175ea2 usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Sun Nov 07 10:56:06 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Sun Nov 07 11:08:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.110 2021/11/07 10:56:06 rillig Exp $  */
+/*     $NetBSD: pr_comment.c,v 1.111 2021/11/07 11:08:25 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.110 2021/11/07 10:56:06 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.111 2021/11/07 11:08:25 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -224,9 +224,6 @@
            break;
 
        case '\n':
-           if (token.e[-1] == '/')
-               goto end_of_line_comment;
-
            if (had_eof) {
                diag(1, "Unterminated comment");
                dump_line();
@@ -268,11 +265,10 @@
 
        case '*':
            inp_skip();
-           if (*inp.s == '/' && token.e[-1] == '*') {
+           if (*inp.s == '/') {
        end_of_comment:
                inp_skip();
 
-       end_of_line_comment:
                if (break_delim) {
                    if (com.e > com.s + 3)
                        dump_line();
@@ -283,10 +279,8 @@
 
                if (!ch_isblank(com.e[-1]))
                    com_add_char(' ');
-               if (token.e[-1] == '*') {
-                   com_add_char('*');
-                   com_add_char('/');
-               }
+               com_add_char('*');
+               com_add_char('/');
                com_terminate();
                return;
 



Home | Main Index | Thread Index | Old Index