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: rename seen_quest to quest_level



details:   https://anonhg.NetBSD.org/src/rev/e2c57dbd4a8f
branches:  trunk
changeset: 1024464:e2c57dbd4a8f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 24 20:57:11 2021 +0000

description:
indent: rename seen_quest to quest_level

The new name aligns with other similar variables like ind_level,
case_ind_level and ifdef_level. The old name 'seen' is mainly used for
bool variables.

No functional change.

diffstat:

 usr.bin/indent/indent.c |  30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diffs (98 lines):

diff -r b72aa10f6332 -r e2c57dbd4a8f usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Sun Oct 24 20:47:00 2021 +0000
+++ b/usr.bin/indent/indent.c   Sun Oct 24 20:57:11 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.151 2021/10/24 20:43:27 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.152 2021/10/24 20:57:11 rillig Exp $      */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.151 2021/10/24 20:43:27 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.152 2021/10/24 20:57:11 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -831,9 +831,9 @@
 }
 
 static void
-process_question(int *seen_quest)
+process_question(int *quest_level)
 {
-    (*seen_quest)++;
+    (*quest_level)++;
     if (ps.want_blank)
        *code.e++ = ' ';
     *code.e++ = '?';
@@ -841,10 +841,10 @@
 }
 
 static void
-process_colon(int *seen_quest, bool *force_nl, bool *seen_case)
+process_colon(int *quest_level, bool *force_nl, bool *seen_case)
 {
-    if (*seen_quest > 0) {     /* part of a '?:' operator */
-       --*seen_quest;
+    if (*quest_level > 0) {    /* part of a '?:' operator */
+       --*quest_level;
        if (ps.want_blank)
            *code.e++ = ' ';
        *code.e++ = ':';
@@ -871,7 +871,7 @@
 }
 
 static void
-process_semicolon(bool *seen_case, int *seen_quest, int decl_ind,
+process_semicolon(bool *seen_case, int *quest_level, int decl_ind,
     bool tabs_to_var, bool *sp_sw,
     token_type hd_type,
     bool *force_nl)
@@ -879,7 +879,7 @@
     if (ps.decl_nest == 0)
        ps.init_or_struct = false;
     *seen_case = false;                /* these will only need resetting in an error */
-    *seen_quest = 0;
+    *quest_level = 0;
     if (ps.last_token == rparen_or_rbracket)
        ps.in_parameter_declaration = false;
     ps.cast_mask = 0;
@@ -1340,9 +1340,9 @@
                                 * if(...), while(...), etc. */
     token_type hd_type = end_of_file;  /* the type of statement for if (...),
                                 * for (...), etc */
-    int seen_quest = 0;                /* when this is positive, we have seen a '?'
-                                * without the matching ':' in a <c>?<s>:<s>
-                                * construct */
+    int quest_level = 0;       /* when this is positive, we have seen a '?'
+                                * without the matching ':' in a '?:'
+                                * expression */
     bool seen_case = false;    /* set to true when we see a 'case', so we
                                 * know what to do with the following colon */
 
@@ -1407,7 +1407,7 @@
            break;
 
        case question:
-           process_question(&seen_quest);
+           process_question(&quest_level);
            break;
 
        case case_label:        /* got word 'case' or 'default' */
@@ -1415,11 +1415,11 @@
            goto copy_token;
 
        case colon:
-           process_colon(&seen_quest, &force_nl, &seen_case);
+           process_colon(&quest_level, &force_nl, &seen_case);
            break;
 
        case semicolon:
-           process_semicolon(&seen_case, &seen_quest, decl_ind, tabs_to_var,
+           process_semicolon(&seen_case, &quest_level, decl_ind, tabs_to_var,
                &sp_sw, hd_type, &force_nl);
            break;
 



Home | Main Index | Thread Index | Old Index