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: clean up control flow, remove Capsicum



details:   https://anonhg.NetBSD.org/src/rev/ab792a15dbfa
branches:  trunk
changeset: 366018:ab792a15dbfa
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon May 09 21:41:49 2022 +0000

description:
indent: clean up control flow, remove Capsicum

No functional change.

diffstat:

 usr.bin/indent/indent.c     |   7 ++-----
 usr.bin/indent/pr_comment.c |  19 ++++++++++---------
 2 files changed, 12 insertions(+), 14 deletions(-)

diffs (76 lines):

diff -r c24a91bdb788 -r ab792a15dbfa usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Mon May 09 21:24:42 2022 +0000
+++ b/usr.bin/indent/indent.c   Mon May 09 21:41:49 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.244 2022/04/23 06:43:22 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.245 2022/05/09 21:41:49 rillig Exp $      */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.244 2022/04/23 06:43:22 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.245 2022/05/09 21:41:49 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -1442,9 +1442,6 @@
     main_init_globals();
     main_load_profiles(argc, argv);
     main_parse_command_line(argc, argv);
-#if HAVE_CAPSICUM
-    init_capsicum();
-#endif
     main_prepare_parsing();
     main_loop();
 }
diff -r c24a91bdb788 -r ab792a15dbfa usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Mon May 09 21:24:42 2022 +0000
+++ b/usr.bin/indent/pr_comment.c       Mon May 09 21:41:49 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.127 2022/04/23 06:43:22 rillig Exp $  */
+/*     $NetBSD: pr_comment.c,v 1.128 2022/05/09 21:41:49 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.127 2022/04/23 06:43:22 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.128 2022/05/09 21:41:49 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -320,8 +320,10 @@
 {
     for (;;) {
        if (inp_peek() == '\n') {
-           if (token.e[-1] == '/')
-               goto finish;
+           if (token.e[-1] == '/') {
+               com_terminate();
+               return;
+           }
 
            if (had_eof) {
                diag(1, "Unterminated comment");
@@ -338,12 +340,11 @@
        }
 
        com_add_char(inp_next());
-       if (com.e[-2] == '*' && com.e[-1] == '/' && token.e[-1] == '*')
-           goto finish;
+       if (com.e[-2] == '*' && com.e[-1] == '/' && token.e[-1] == '*') {
+           com_terminate();
+           return;
+       }
     }
-
-finish:
-    com_terminate();
 }
 
 /*



Home | Main Index | Thread Index | Old Index