Module Name: src
Committed By: rillig
Date: Thu Nov 25 07:41:13 UTC 2021
Modified Files:
src/usr.bin/indent: indent.c indent.h io.c lexi.c
Log Message:
indent: rename ps.ind_stmt to in_stmt_cont
This makes a comment redundant.
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/indent/io.c
cvs rdiff -u -r1.150 -r1.151 src/usr.bin/indent/lexi.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.229 src/usr.bin/indent/indent.c:1.230
--- src/usr.bin/indent/indent.c:1.229 Thu Nov 25 07:30:54 2021
+++ src/usr.bin/indent/indent.c Thu Nov 25 07:41:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.c,v 1.229 2021/11/25 07:30:54 rillig Exp $ */
+/* $NetBSD: indent.c,v 1.230 2021/11/25 07:41:13 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.229 2021/11/25 07:30:54 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.230 2021/11/25 07:41:13 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
#endif
@@ -917,7 +917,7 @@ process_lbrace(bool *force_nl, bool *spa
}
if (code.s == code.e)
- ps.ind_stmt = false; /* don't indent the '{' itself */
+ ps.in_stmt_cont = false; /* don't indent the '{' itself */
if (ps.in_decl && ps.init_or_struct) {
di_stack[ps.decl_level] = *decl_ind;
if (++ps.decl_level == di_stack_cap) {
@@ -970,7 +970,7 @@ process_rbrace(bool *spaced_expr, int *d
*code.e++ = '}';
ps.want_blank = true;
ps.in_stmt = false;
- ps.ind_stmt = false;
+ ps.in_stmt_cont = false;
if (ps.decl_level > 0) { /* we are in multi-level structure declaration */
*decl_ind = di_stack[--ps.decl_level];
@@ -1041,7 +1041,7 @@ process_type(int *decl_ind, bool *tabs_t
if (ps.in_parameter_declaration && opt.indent_parameters &&
ps.decl_level == 0) {
ps.ind_level = ps.ind_level_follow = 1;
- ps.ind_stmt = false;
+ ps.in_stmt_cont = false;
}
ps.init_or_struct = /* maybe */ true;
Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.98 src/usr.bin/indent/indent.h:1.99
--- src/usr.bin/indent/indent.h:1.98 Fri Nov 19 20:23:17 2021
+++ src/usr.bin/indent/indent.h Thu Nov 25 07:41:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.h,v 1.98 2021/11/19 20:23:17 rillig Exp $ */
+/* $NetBSD: indent.h,v 1.99 2021/11/25 07:41:13 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -316,7 +316,7 @@ extern struct parser_state {
bool in_stmt; /* TODO: rename to something appropriate; this
* is set to true in struct declarations as
* well, so 'stmt' isn't accurate */
- bool ind_stmt; /* whether the next line should have an extra
+ bool in_stmt_cont; /* whether the next line should have an extra
* indentation level because we are in the
* middle of a statement */
bool is_case_label; /* 'case' and 'default' labels are indented
Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.129 src/usr.bin/indent/io.c:1.130
--- src/usr.bin/indent/io.c:1.129 Fri Nov 19 20:23:17 2021
+++ src/usr.bin/indent/io.c Thu Nov 25 07:41:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.129 2021/11/19 20:23:17 rillig Exp $ */
+/* $NetBSD: io.c,v 1.130 2021/11/25 07:41:13 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.129 2021/11/19 20:23:17 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.130 2021/11/25 07:41:13 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
@@ -471,9 +471,7 @@ output_line(char line_terminator)
output_char('\n');
if (ps.ind_level == 0)
- ps.ind_stmt = false; /* this is a class A kludge. don't do
- * additional statement indentation if
- * we are at bracket level 0 */
+ ps.in_stmt_cont = false; /* this is a class A kludge */
if (lab.e != lab.s || code.e != code.s)
ps.stats.code_lines++;
@@ -498,7 +496,7 @@ output_line(char line_terminator)
}
ps.decl_on_line = ps.in_decl; /* for proper comment indentation */
- ps.ind_stmt = ps.in_stmt && !ps.in_decl;
+ ps.in_stmt_cont = ps.in_stmt && !ps.in_decl;
ps.decl_indent_done = false;
*(lab.e = lab.s) = '\0'; /* reset buffers */
@@ -553,7 +551,7 @@ compute_code_indent(void)
int base_ind = ps.ind_level * opt.indent_size;
if (ps.paren_level == 0) {
- if (ps.ind_stmt)
+ if (ps.in_stmt_cont)
return base_ind + opt.continuation_indent;
return base_ind;
}
Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.150 src/usr.bin/indent/lexi.c:1.151
--- src/usr.bin/indent/lexi.c:1.150 Sat Nov 20 09:59:53 2021
+++ src/usr.bin/indent/lexi.c Thu Nov 25 07:41:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lexi.c,v 1.150 2021/11/20 09:59:53 rillig Exp $ */
+/* $NetBSD: lexi.c,v 1.151 2021/11/25 07:41:13 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 (
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.150 2021/11/20 09:59:53 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.151 2021/11/25 07:41:13 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
#endif
@@ -305,7 +305,7 @@ debug_lexi(lexer_symbol lsym)
debug_ps_bool(decl_indent_done);
debug_ps_bool(in_stmt);
- debug_ps_bool(ind_stmt);
+ debug_ps_bool(in_stmt_cont);
debug_ps_bool(is_case_label);
debug_ps_bool(search_stmt);