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: inline switch_buffer
details: https://anonhg.NetBSD.org/src/rev/b274ae1ee092
branches: trunk
changeset: 1026515:b274ae1ee092
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Nov 27 18:29:29 2021 +0000
description:
indent: inline switch_buffer
The function name was not accurate all the time. Now that
inp_from_comment is a separate function, it doesn't make sense anymore
to offload the 3 simple statements to a separate function.
No functional change.
diffstat:
usr.bin/indent/indent.c | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
diffs (69 lines):
diff -r 39745438c9a3 -r b274ae1ee092 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c Sat Nov 27 18:26:48 2021 +0000
+++ b/usr.bin/indent/indent.c Sat Nov 27 18:29:29 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.c,v 1.234 2021/11/26 15:18:18 rillig Exp $ */
+/* $NetBSD: indent.c,v 1.235 2021/11/27 18:29:29 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.234 2021/11/26 15:18:18 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.235 2021/11/27 18:29:29 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
#endif
@@ -269,11 +269,11 @@
if (token.e[-1] == '/') {
while (inp_peek() != '\n')
inp_comment_add_char(inp_next());
- debug_inp("search_stmt_comment end C99");
+ debug_inp("search_stmt_comment: end of C99 comment");
} else {
while (!inp_comment_complete_block())
inp_comment_add_char(inp_next());
- debug_inp("search_stmt_comment end block");
+ debug_inp("search_stmt_comment: end of block comment");
}
}
@@ -330,8 +330,8 @@
inp_comment_rtrim_newline();
}
- if (*force_nl) { /* if we should insert a nl here, put it into
- * the buffer */
+ if (*force_nl) { /* if we should insert a newline here, put it
+ * into the buffer */
*force_nl = false;
--line_no; /* this will be re-increased when the newline
* is read from the buffer */
@@ -348,14 +348,6 @@
}
static void
-switch_buffer(void)
-{
- ps.search_stmt = false;
- inp_comment_add_char(' '); /* add trailing blank, just in case */
- inp_from_comment();
-}
-
-static void
search_stmt_lookahead(lexer_symbol *lsym)
{
if (*lsym == lsym_eof)
@@ -426,7 +418,9 @@
*last_else))
return;
switch_buffer:
- switch_buffer();
+ ps.search_stmt = false;
+ inp_comment_add_char(' '); /* add trailing blank, just in case */
+ inp_from_comment();
}
search_stmt_lookahead(lsym);
}
Home |
Main Index |
Thread Index |
Old Index