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: improve local variable names



details:   https://anonhg.NetBSD.org/src/rev/db6450cc5819
branches:  trunk
changeset: 1024056:db6450cc5819
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 08 21:16:23 2021 +0000

description:
indent: improve local variable names

No functional change.

diffstat:

 usr.bin/indent/io.c   |  20 ++++++++++----------
 usr.bin/indent/lexi.c |  18 +++++++++---------
 2 files changed, 19 insertions(+), 19 deletions(-)

diffs (138 lines):

diff -r 0036520a2527 -r db6450cc5819 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Fri Oct 08 21:13:58 2021 +0000
+++ b/usr.bin/indent/io.c       Fri Oct 08 21:16:23 2021 +0000
@@ -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 @@
 
 #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 @@
 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 @@
 
     } 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 @@
        debug_println("paren_indent is now %d", paren_indent);
     }
 
-    not_first_line = true;
+    first_line = false;
 }
 
 int
@@ -369,7 +369,7 @@
 static void
 parse_indent_comment(void)
 {
-    bool on_off;
+    bool on;
 
     const char *p = inp.buf;
 
@@ -382,9 +382,9 @@
     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 @@
     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;
diff -r 0036520a2527 -r db6450cc5819 usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Fri Oct 08 21:13:58 2021 +0000
+++ b/usr.bin/indent/lexi.c     Fri Oct 08 21:16:23 2021 +0000
@@ -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 @@
 
 #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 @@
  * 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 @@
 };
 /* 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 @@
 {
     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();
     }



Home | Main Index | Thread Index | Old Index