Module Name:    src
Committed By:   rillig
Date:           Thu Jun 15 10:59:06 UTC 2023

Modified Files:
        src/usr.bin/indent: debug.c indent.c indent.h io.c

Log Message:
indent: rename state variable to be more accurate

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.370 -r1.371 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.223 -r1.224 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/usr.bin/indent/debug.c
diff -u src/usr.bin/indent/debug.c:1.61 src/usr.bin/indent/debug.c:1.62
--- src/usr.bin/indent/debug.c:1.61	Wed Jun 14 20:46:08 2023
+++ src/usr.bin/indent/debug.c	Thu Jun 15 10:59:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: debug.c,v 1.61 2023/06/14 20:46:08 rillig Exp $	*/
+/*	$NetBSD: debug.c,v 1.62 2023/06/15 10:59:06 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: debug.c,v 1.61 2023/06/14 20:46:08 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.62 2023/06/15 10:59:06 rillig Exp $");
 
 #include <stdarg.h>
 #include <string.h>
@@ -344,7 +344,7 @@ debug_parser_state(void)
 	state.heading = "indentation of statements and declarations";
 	debug_ps_int(ind_level);
 	debug_ps_int(ind_level_follow);
-	debug_ps_bool(in_stmt_cont);
+	debug_ps_bool(line_is_stmt_cont);
 	debug_ps_int(decl_level);
 	debug_ps_di_stack();
 	debug_ps_bool(decl_indent_done);

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.370 src/usr.bin/indent/indent.c:1.371
--- src/usr.bin/indent/indent.c:1.370	Thu Jun 15 10:34:12 2023
+++ src/usr.bin/indent/indent.c	Thu Jun 15 10:59:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.370 2023/06/15 10:34:12 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.371 2023/06/15 10:59:06 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: indent.c,v 1.370 2023/06/15 10:34:12 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.371 2023/06/15 10:59:06 rillig Exp $");
 
 #include <sys/param.h>
 #include <err.h>
@@ -566,7 +566,7 @@ process_newline(void)
 	    && ps.psyms.sym[ps.psyms.len - 2] == psym_lbrace_enum
 	    && ps.paren.len == 0
 	    && ps.prev_lsym == lsym_comma)
-		ps.in_stmt_cont = false;
+		ps.line_is_stmt_cont = false;
 
 stay_in_line:
 	++line_no;
@@ -724,8 +724,7 @@ process_lbrace(void)
 	}
 
 	if (code.len == 0)
-		ps.in_stmt_cont = false;	/* don't indent the '{' itself
-						 */
+		ps.line_is_stmt_cont = false;
 	if (ps.in_decl && ps.in_var_decl) {
 		ps.di_stack[ps.decl_level] = ps.decl_ind;
 		if (++ps.decl_level == (int)array_length(ps.di_stack)) {
@@ -768,7 +767,7 @@ process_rbrace(void)
 	buf_add_char(&code, '}');
 	ps.want_blank = true;
 	ps.in_stmt_or_decl = false;	// XXX: Initializers don't end a stmt
-	ps.in_stmt_cont = false;
+	ps.line_is_stmt_cont = false;
 
 	if (ps.decl_level > 0) {	/* multi-level structure declaration */
 		ps.decl_ind = ps.di_stack[--ps.decl_level];
@@ -925,7 +924,7 @@ process_type_outside_parentheses(void)
 	if (ps.in_func_def_params && opt.indent_parameters &&
 	    ps.decl_level == 0) {
 		ps.ind_level = ps.ind_level_follow = 1;
-		ps.in_stmt_cont = false;
+		ps.line_is_stmt_cont = false;
 	}
 
 	ps.in_var_decl = /* maybe */ true;

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.197 src/usr.bin/indent/indent.h:1.198
--- src/usr.bin/indent/indent.h:1.197	Wed Jun 14 20:46:08 2023
+++ src/usr.bin/indent/indent.h	Thu Jun 15 10:59:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.197 2023/06/14 20:46:08 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.198 2023/06/15 10:59:06 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -342,7 +342,7 @@ extern struct parser_state {
 				 * currently prepared for output */
 	int ind_level_follow;	/* the level to which ind_level should be set
 				 * after the current line is printed */
-	bool in_stmt_cont;	/* whether the current line should have an
+	bool line_is_stmt_cont;	/* whether the current line should have an
 				 * extra indentation level because we are in
 				 * the middle of a statement */
 	int decl_level;		/* current nesting level for a structure

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.223 src/usr.bin/indent/io.c:1.224
--- src/usr.bin/indent/io.c:1.223	Thu Jun 15 10:34:12 2023
+++ src/usr.bin/indent/io.c	Thu Jun 15 10:59:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.223 2023/06/15 10:34:12 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.224 2023/06/15 10:59:06 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: io.c,v 1.223 2023/06/15 10:34:12 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.224 2023/06/15 10:59:06 rillig Exp $");
 
 #include <stdio.h>
 
@@ -254,7 +254,7 @@ compute_code_indent(void)
 	int base_ind = ps.ind_level * opt.indent_size;
 
 	if (ps.ind_paren_level == 0) {
-		if (ps.in_stmt_cont)
+		if (ps.line_is_stmt_cont)
 			return base_ind + opt.continuation_indent;
 		return base_ind;
 	}
@@ -342,7 +342,7 @@ output_indented_line(void)
 
 	/* This kludge aligns function definitions correctly. */
 	if (ps.ind_level == 0)
-		ps.in_stmt_cont = false;
+		ps.line_is_stmt_cont = false;
 
 	if (opt.blank_line_after_decl && ps.declaration == decl_end
 	    && ps.psyms.len > 2) {
@@ -393,7 +393,7 @@ output_line(void)
 
 	ps.line_has_decl = ps.in_decl;
 	ps.line_has_func_def = false;
-	ps.in_stmt_cont = ps.in_stmt_or_decl
+	ps.line_is_stmt_cont = ps.in_stmt_or_decl
 	    && (!ps.in_decl || ps.in_init)
 	    && ps.init_level == 0;
 	ps.decl_indent_done = false;

Reply via email to