Module Name: src
Committed By: rillig
Date: Tue Oct 19 21:21:07 UTC 2021
Modified Files:
src/tests/usr.bin/indent: indent_off_on.c
src/usr.bin/indent: io.c
Log Message:
indent: use simpler code for copying the input buffer
In debug mode, this reduces the amount of debug output lines.
No functional change in default mode.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/indent_off_on.c
cvs rdiff -u -r1.95 -r1.96 src/usr.bin/indent/io.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/indent/indent_off_on.c
diff -u src/tests/usr.bin/indent/indent_off_on.c:1.2 src/tests/usr.bin/indent/indent_off_on.c:1.3
--- src/tests/usr.bin/indent/indent_off_on.c:1.2 Tue Oct 19 20:41:42 2021
+++ src/tests/usr.bin/indent/indent_off_on.c Tue Oct 19 21:21:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: indent_off_on.c,v 1.2 2021/10/19 20:41:42 rillig Exp $ */
+/* $NetBSD: indent_off_on.c,v 1.3 2021/10/19 21:21:07 rillig Exp $ */
/* $FreeBSD$ */
/*
@@ -33,6 +33,24 @@
#indent input
{}
+
+
+/*INDENT OFF*/
+/*INDENT ON*/
+#indent end
+
+#indent run
+{
+}
+/* $ FIXME: This empty line must stay. */
+/* $ FIXME: This empty line must stay. */
+/*INDENT OFF*/
+/* INDENT ON */
+#indent end
+
+
+#indent input
+{}
/* INDENT OFF */
/* INDENT ON */
{}
Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.95 src/usr.bin/indent/io.c:1.96
--- src/usr.bin/indent/io.c:1.95 Tue Oct 19 18:29:59 2021
+++ src/usr.bin/indent/io.c Tue Oct 19 21:21:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.95 2021/10/19 18:29:59 rillig Exp $ */
+/* $NetBSD: io.c,v 1.96 2021/10/19 21:21:07 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Be
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.95 2021/10/19 18:29:59 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.96 2021/10/19 21:21:07 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
@@ -451,10 +451,8 @@ inbuf_read_line(void)
parse_indent_comment();
}
- if (inhibit_formatting) {
- for (p = inp.s; p < inp.e; p++)
- output_char(*p);
- }
+ if (inhibit_formatting)
+ output_range(inp.s, inp.e);
}
int