Module Name: src
Committed By: rillig
Date: Sat Sep 25 22:57:05 UTC 2021
Modified Files:
src/usr.bin/indent: indent.c indent_globs.h io.c
Log Message:
indent: misc cleanup
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/indent/indent_globs.h
cvs rdiff -u -r1.65 -r1.66 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/indent.c
diff -u src/usr.bin/indent/indent.c:1.83 src/usr.bin/indent/indent.c:1.84
--- src/usr.bin/indent/indent.c:1.83 Sat Sep 25 22:54:32 2021
+++ src/usr.bin/indent/indent.c Sat Sep 25 22:57:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.c,v 1.83 2021/09/25 22:54:32 rillig Exp $ */
+/* $NetBSD: indent.c,v 1.84 2021/09/25 22:57:04 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.83 2021/09/25 22:54:32 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.84 2021/09/25 22:57:04 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
#endif
@@ -529,7 +529,7 @@ process_comment_in_code(token_type ttype
}
ps.in_stmt = true; /* turn on flag which causes an extra level of
- * indentation. this is turned off by a ; or
+ * indentation. this is turned off by a ';' or
* '}' */
if (com.s != com.e) { /* the turkey has embedded a comment
* in a line. fix it */
@@ -1210,7 +1210,7 @@ main_loop(void)
int squest; /* when this is positive, we have seen a '?'
* without the matching ':' in a <c>?<s>:<s>
* construct */
- bool scase; /* set to true when we see a case, so we will
+ bool scase; /* set to true when we see a 'case', so we
* know what to do with the following colon */
sp_sw = force_nl = false;
Index: src/usr.bin/indent/indent_globs.h
diff -u src/usr.bin/indent/indent_globs.h:1.36 src/usr.bin/indent/indent_globs.h:1.37
--- src/usr.bin/indent/indent_globs.h:1.36 Sat Sep 25 22:54:32 2021
+++ src/usr.bin/indent/indent_globs.h Sat Sep 25 22:57:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: indent_globs.h,v 1.36 2021/09/25 22:54:32 rillig Exp $ */
+/* $NetBSD: indent_globs.h,v 1.37 2021/09/25 22:57:04 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -137,7 +137,7 @@ extern struct options {
* will be lined up to the open paren */
bool proc_calls_space; /* whether procedure calls look like:
* foo (bar) rather than foo(bar) */
- bool procnames_start_line; /* whether, the names of procedures
+ bool procnames_start_line; /* whether the names of procedures
* being defined get placed in column 1 (i.e.
* a newline is placed between the type of
* the procedure and its name) */
@@ -208,11 +208,11 @@ extern struct parser_state {
int not_cast_mask; /* indicates which close parens definitely
* close off something else than casts */
bool block_init; /* whether inside a block initialization */
- int block_init_level; /* The level of brace nesting in an
- * initialization */
- bool last_nl; /* this is true if the last thing scanned was
+ int block_init_level; /* The level of brace nesting in an
+ * initialization */
+ bool last_nl; /* whether the last thing scanned was
* a newline */
- bool in_or_st; /* Will be true iff there has been a
+ bool in_or_st; /* true iff there has been a
* declarator (e.g. int or char) and no left
* paren since the last semicolon. When true,
* a '{' is starting a structure definition or
@@ -229,7 +229,7 @@ extern struct parser_state {
bool in_decl; /* whether we are in a declaration stmt.
* The processing of braces is then slightly
* different */
- bool in_stmt; /* whether in a stmt */
+ bool in_stmt;
int ind_level; /* the current indentation level */
bool ind_stmt; /* whether the next line should have an extra
* indentation level because we are in the
Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.65 src/usr.bin/indent/io.c:1.66
--- src/usr.bin/indent/io.c:1.65 Sat Sep 25 22:54:32 2021
+++ src/usr.bin/indent/io.c Sat Sep 25 22:57:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.65 2021/09/25 22:54:32 rillig Exp $ */
+/* $NetBSD: io.c,v 1.66 2021/09/25 22:57:04 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -43,21 +43,19 @@ static char sccsid[] = "@(#)io.c 8.1 (Be
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.65 2021/09/25 22:54:32 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.66 2021/09/25 22:57:04 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
#include <ctype.h>
-#include <err.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "indent.h"
-bool comment_open;
+static bool comment_open;
static int paren_indent;
static void