Module Name: src
Committed By: rillig
Date: Mon May 9 21:41:49 UTC 2022
Modified Files:
src/usr.bin/indent: indent.c pr_comment.c
Log Message:
indent: clean up control flow, remove Capsicum
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.127 -r1.128 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/indent.c
diff -u src/usr.bin/indent/indent.c:1.244 src/usr.bin/indent/indent.c:1.245
--- src/usr.bin/indent/indent.c:1.244 Sat Apr 23 06:43:22 2022
+++ src/usr.bin/indent/indent.c Mon May 9 21:41:49 2022
@@ -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 @@ static char sccsid[] = "@(#)indent.c 5.1
#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(int argc, char **argv)
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();
}
Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.127 src/usr.bin/indent/pr_comment.c:1.128
--- src/usr.bin/indent/pr_comment.c:1.127 Sat Apr 23 06:43:22 2022
+++ src/usr.bin/indent/pr_comment.c Mon May 9 21:41:49 2022
@@ -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 @@ static char sccsid[] = "@(#)pr_comment.c
#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 @@ copy_comment_nowrap(void)
{
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 @@ copy_comment_nowrap(void)
}
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();
}
/*