Module Name:    src
Committed By:   rillig
Date:           Fri Oct  8 21:16:23 UTC 2021

Modified Files:
        src/usr.bin/indent: io.c lexi.c

Log Message:
indent: improve local variable names

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/indent/io.c
cvs rdiff -u -r1.81 -r1.82 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/io.c
diff -u src/usr.bin/indent/io.c:1.89 src/usr.bin/indent/io.c:1.90
--- src/usr.bin/indent/io.c:1.89	Fri Oct  8 21:13:58 2021
+++ src/usr.bin/indent/io.c	Fri Oct  8 21:16:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.89 2021/10/08 21:13:58 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.90 2021/10/08 21:16:23 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.89 2021/10/08 21:13:58 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.90 2021/10/08 21:16:23 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -219,7 +219,7 @@ dump_line_comment(int ind)
 void
 dump_line(void)
 {
-    static bool not_first_line;
+    static bool first_line = true;
 
     if (ps.procname[0] != '\0') {
 	ps.ind_level = 0;
@@ -234,7 +234,7 @@ dump_line(void)
 
     } else if (!inhibit_formatting) {
 	suppress_blanklines = 0;
-	if (prefix_blankline_requested && not_first_line) {
+	if (prefix_blankline_requested && !first_line) {
 	    if (opt.swallow_optional_blanklines) {
 		if (next_blank_lines == 1)
 		    next_blank_lines = 0;
@@ -296,7 +296,7 @@ dump_line(void)
 	debug_println("paren_indent is now %d", paren_indent);
     }
 
-    not_first_line = true;
+    first_line = false;
 }
 
 int
@@ -369,7 +369,7 @@ skip_string(const char **pp, const char 
 static void
 parse_indent_comment(void)
 {
-    bool on_off;
+    bool on;
 
     const char *p = inp.buf;
 
@@ -382,9 +382,9 @@ parse_indent_comment(void)
     skip_hspace(&p);
 
     if (*p == '*' || skip_string(&p, "ON"))
-	on_off = true;
+	on = true;
     else if (skip_string(&p, "OFF"))
-	on_off = false;
+	on = false;
     else
 	return;
 
@@ -395,8 +395,8 @@ parse_indent_comment(void)
     if (com.s != com.e || lab.s != lab.e || code.s != code.e)
 	dump_line();
 
-    inhibit_formatting = !on_off;
-    if (on_off) {
+    inhibit_formatting = !on;
+    if (on) {
 	next_blank_lines = 0;
 	postfix_blankline_requested = false;
 	prefix_blankline_requested = false;

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.81 src/usr.bin/indent/lexi.c:1.82
--- src/usr.bin/indent/lexi.c:1.81	Fri Oct  8 21:13:58 2021
+++ src/usr.bin/indent/lexi.c	Fri Oct  8 21:16:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.81 2021/10/08 21:13:58 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.82 2021/10/08 21:16:23 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.81 2021/10/08 21:13:58 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.82 2021/10/08 21:16:23 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -129,7 +129,7 @@ struct {
  * HP H+ "."    P  FS  -> $float;    BP B+           IS? -> $int;
  */
 /* INDENT OFF */
-static const unsigned char num_lex_state[][26] = {
+static const unsigned char lex_number_state[][26] = {
     /*                examples:
                                      00
              s                      0xx
@@ -158,7 +158,7 @@ static const unsigned char num_lex_state
 };
 /* INDENT ON */
 
-static const uint8_t num_lex_row[] = {
+static const uint8_t lex_number_row[] = {
     ['0'] = 1,
     ['1'] = 2,
     ['2'] = 3, ['3'] = 3, ['4'] = 3, ['5'] = 3, ['6'] = 3, ['7'] = 3,
@@ -270,19 +270,19 @@ lex_number(void)
 {
     for (uint8_t s = 'A'; s != 'f' && s != 'i' && s != 'u';) {
 	uint8_t ch = (uint8_t)*inp.s;
-	if (ch >= nitems(num_lex_row) || num_lex_row[ch] == 0)
+	if (ch >= nitems(lex_number_row) || lex_number_row[ch] == 0)
 	    break;
 
-	uint8_t row = num_lex_row[ch];
-	if (num_lex_state[row][s - 'A'] == ' ') {
+	uint8_t row = lex_number_row[ch];
+	if (lex_number_state[row][s - 'A'] == ' ') {
 	    /*-
-	     * num_lex_state[0][s - 'A'] now indicates the type:
+	     * lex_number_state[0][s - 'A'] now indicates the type:
 	     * f = floating, i = integer, u = unknown
 	     */
 	    break;
 	}
 
-	s = num_lex_state[row][s - 'A'];
+	s = lex_number_state[row][s - 'A'];
 	check_size_token(1);
 	*token.e++ = inbuf_next();
     }

Reply via email to