Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: rename variable 'level' to 'bl'



details:   https://anonhg.NetBSD.org/src/rev/c3b896935fb9
branches:  trunk
changeset: 954126:c3b896935fb9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Mar 29 21:34:17 2021 +0000

description:
lint: rename variable 'level' to 'bl'

For consistency with its type prefix and the other variables.  This
variable is used so often that it makes sense to abbreviate it.

No functional change.

diffstat:

 usr.bin/xlint/lint1/init.c |  316 ++++++++++++++++++++++----------------------
 1 files changed, 158 insertions(+), 158 deletions(-)

diffs (truncated from 705 to 300 lines):

diff -r 96760bb86f82 -r c3b896935fb9 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c        Mon Mar 29 21:09:21 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c        Mon Mar 29 21:34:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.177 2021/03/29 21:09:21 rillig Exp $        */
+/*     $NetBSD: init.c,v 1.178 2021/03/29 21:34:17 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.177 2021/03/29 21:09:21 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.178 2021/03/29 21:34:17 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -542,20 +542,20 @@
 brace_level_new(type_t *type, type_t *subtype, int remaining,
                struct brace_level *enclosing)
 {
-       struct brace_level *level = xcalloc(1, sizeof(*level));
+       struct brace_level *bl = xcalloc(1, sizeof(*bl));
 
-       level->bl_type = type;
-       level->bl_subtype = subtype;
-       level->bl_remaining = remaining;
-       level->bl_enclosing = enclosing;
+       bl->bl_type = type;
+       bl->bl_subtype = subtype;
+       bl->bl_remaining = remaining;
+       bl->bl_enclosing = enclosing;
 
-       return level;
+       return bl;
 }
 
 static void
-brace_level_free(struct brace_level *level)
+brace_level_free(struct brace_level *bl)
 {
-       free(level);
+       free(bl);
 }
 
 #ifdef DEBUG
@@ -565,98 +565,98 @@
  * TODO: wrap all write accesses to brace_level in setter functions
  */
 static void
-brace_level_debug(const struct brace_level *level)
+brace_level_debug(const struct brace_level *bl)
 {
-       if (level->bl_type != NULL)
-               debug_printf("type '%s'", type_name(level->bl_type));
-       if (level->bl_type != NULL && level->bl_subtype != NULL)
+       if (bl->bl_type != NULL)
+               debug_printf("type '%s'", type_name(bl->bl_type));
+       if (bl->bl_type != NULL && bl->bl_subtype != NULL)
                debug_printf(", ");
-       if (level->bl_subtype != NULL)
-               debug_printf("subtype '%s'", type_name(level->bl_subtype));
+       if (bl->bl_subtype != NULL)
+               debug_printf("subtype '%s'", type_name(bl->bl_subtype));
 
-       if (level->bl_brace)
+       if (bl->bl_brace)
                debug_printf(", needs closing brace");
-       if (level->bl_array_of_unknown_size)
+       if (bl->bl_array_of_unknown_size)
                debug_printf(", array of unknown size");
-       if (level->bl_seen_named_member)
+       if (bl->bl_seen_named_member)
                debug_printf(", seen named member");
 
-       const type_t *eff_type = level->bl_type != NULL
-           ? level->bl_type : level->bl_subtype;
-       if (eff_type->t_tspec == STRUCT && level->bl_next_member != NULL)
+       const type_t *eff_type = bl->bl_type != NULL
+           ? bl->bl_type : bl->bl_subtype;
+       if (eff_type->t_tspec == STRUCT && bl->bl_next_member != NULL)
                debug_printf(", next member '%s'",
-                   level->bl_next_member->s_name);
+                   bl->bl_next_member->s_name);
 
-       debug_printf(", remaining %d\n", level->bl_remaining);
+       debug_printf(", remaining %d\n", bl->bl_remaining);
 }
 #else
-#define brace_level_debug(level) do { } while (false)
+#define brace_level_debug(bl) do { } while (false)
 #endif
 
 static void
-brace_level_assert_struct_or_union(const struct brace_level *level)
+brace_level_assert_struct_or_union(const struct brace_level *bl)
 {
-       lint_assert(is_struct_or_union(level->bl_type->t_tspec));
+       lint_assert(is_struct_or_union(bl->bl_type->t_tspec));
 }
 
 static void
-brace_level_assert_array(const struct brace_level *level)
+brace_level_assert_array(const struct brace_level *bl)
 {
-       lint_assert(level->bl_type->t_tspec == ARRAY);
+       lint_assert(bl->bl_type->t_tspec == ARRAY);
 }
 
 static type_t *
-brace_level_subtype(struct brace_level *level)
+brace_level_subtype(struct brace_level *bl)
 {
 
-       if (level->bl_subtype != NULL)
-               return level->bl_subtype;
+       if (bl->bl_subtype != NULL)
+               return bl->bl_subtype;
 
-       return level->bl_type;
+       return bl->bl_type;
 }
 
 static void
-brace_level_set_array_dimension(struct brace_level *level, int dim)
+brace_level_set_array_dimension(struct brace_level *bl, int dim)
 {
-       brace_level_assert_array(level);
+       brace_level_assert_array(bl);
 
        debug_step("setting the array size to %d", dim);
-       level->bl_type->t_dim = dim;
+       bl->bl_type->t_dim = dim;
        debug_indent();
-       brace_level_debug(level);
+       brace_level_debug(bl);
 }
 
 static void
-brace_level_next_member(struct brace_level *level)
+brace_level_next_member(struct brace_level *bl)
 {
        const sym_t *m;
 
-       brace_level_assert_struct_or_union(level);
+       brace_level_assert_struct_or_union(bl);
        do {
-               m = level->bl_next_member = level->bl_next_member->s_next;
+               m = bl->bl_next_member = bl->bl_next_member->s_next;
                /* XXX: can this assertion be made to fail? */
                lint_assert(m != NULL);
        } while (m->s_bitfield && m->s_name == unnamed);
 
        debug_indent();
-       brace_level_debug(level);
+       brace_level_debug(bl);
 }
 
 static const sym_t *
-brace_level_look_up_member(const struct brace_level *level, const char *name)
+brace_level_look_up_member(const struct brace_level *bl, const char *name)
 {
 
-       brace_level_assert_struct_or_union(level);
-       return look_up_member(level->bl_type->t_str->sou_first_member, name);
+       brace_level_assert_struct_or_union(bl);
+       return look_up_member(bl->bl_type->t_str->sou_first_member, name);
 }
 
 static sym_t *
-brace_level_look_up_first_member_named(struct brace_level *level,
+brace_level_look_up_first_member_named(struct brace_level *bl,
                                       const char *name, int *count)
 {
        sym_t *m;
 
-       for (m = level->bl_type->t_str->sou_first_member;
+       for (m = bl->bl_type->t_str->sou_first_member;
             m != NULL; m = m->s_next) {
                if (is_unnamed_member(m))
                        continue;
@@ -670,20 +670,20 @@
 }
 
 static sym_t *
-brace_level_look_up_first_member_unnamed(struct brace_level *level, int *count)
+brace_level_look_up_first_member_unnamed(struct brace_level *bl, int *count)
 {
        sym_t *m;
 
-       brace_level_assert_struct_or_union(level);
+       brace_level_assert_struct_or_union(bl);
 
-       for (m = level->bl_type->t_str->sou_first_member;
+       for (m = bl->bl_type->t_str->sou_first_member;
             m != NULL; m = m->s_next) {
                if (is_unnamed_member(m))
                        continue;
                /* XXX: What is this code for? */
                if (++(*count) == 1) {
-                       level->bl_next_member = m;
-                       level->bl_subtype = m->s_type;
+                       bl->bl_next_member = m;
+                       bl->bl_subtype = m->s_type;
                }
        }
 
@@ -693,27 +693,27 @@
 /* TODO: document me */
 /* TODO: think of a better name than 'push' */
 static bool
-brace_level_push_array(struct brace_level *level)
+brace_level_push_array(struct brace_level *bl)
 {
-       brace_level_assert_array(level);
+       brace_level_assert_array(bl);
 
-       if (level->bl_enclosing->bl_seen_named_member) {
-               level->bl_brace = true;
+       if (bl->bl_enclosing->bl_seen_named_member) {
+               bl->bl_brace = true;
                debug_step("ARRAY, seen named member, needs closing brace");
        }
 
-       if (is_incomplete(level->bl_type) &&
-           level->bl_enclosing->bl_enclosing != NULL) {
+       if (is_incomplete(bl->bl_type) &&
+           bl->bl_enclosing->bl_enclosing != NULL) {
                /* initialization of an incomplete type */
                error(175);
                return false;
        }
 
-       level->bl_subtype = level->bl_type->t_subt;
-       level->bl_array_of_unknown_size = is_incomplete(level->bl_type);
-       level->bl_remaining = level->bl_type->t_dim;
+       bl->bl_subtype = bl->bl_type->t_subt;
+       bl->bl_array_of_unknown_size = is_incomplete(bl->bl_type);
+       bl->bl_remaining = bl->bl_type->t_dim;
        debug_step("type '%s' remaining %d",
-           type_name(level->bl_type), level->bl_remaining);
+           type_name(bl->bl_type), bl->bl_remaining);
        return true;
 }
 
@@ -726,30 +726,30 @@
  * TODO: think of a better name than 'pop'
  */
 static void
-brace_level_pop_item_unnamed(struct brace_level *level)
+brace_level_pop_item_unnamed(struct brace_level *bl)
 {
-       if (level->bl_remaining > 0 && level->bl_type->t_tspec == STRUCT &&
-           !level->bl_seen_named_member) {
-               brace_level_next_member(level);
-               level->bl_subtype = level->bl_next_member->s_type;
+       if (bl->bl_remaining > 0 && bl->bl_type->t_tspec == STRUCT &&
+           !bl->bl_seen_named_member) {
+               brace_level_next_member(bl);
+               bl->bl_subtype = bl->bl_next_member->s_type;
        }
 }
 
 static bool
-brace_level_check_too_many_initializers(struct brace_level *level)
+brace_level_check_too_many_initializers(struct brace_level *bl)
 {
-       if (level->bl_remaining > 0)
+       if (bl->bl_remaining > 0)
                return true;
        /*
         * FIXME: even with named members, there can be too many initializers
         */
-       if (level->bl_array_of_unknown_size || level->bl_seen_named_member)
+       if (bl->bl_array_of_unknown_size || bl->bl_seen_named_member)
                return true;
 
-       tspec_t t = level->bl_type->t_tspec;
+       tspec_t t = bl->bl_type->t_tspec;
        if (t == ARRAY) {
                /* too many array initializers, expected %d */
-               error(173, level->bl_type->t_dim);
+               error(173, bl->bl_type->t_dim);
        } else if (is_struct_or_union(t)) {
                /* too many struct/union initializers */
                error(172);
@@ -762,10 +762,10 @@
 
 /* Extend an array of unknown size by one element */
 static void
-brace_level_extend_if_array_of_unknown_size(struct brace_level *level)
+brace_level_extend_if_array_of_unknown_size(struct brace_level *bl)
 {
 
-       if (level->bl_remaining != 0)
+       if (bl->bl_remaining != 0)
                return;
        /*
         * XXX: According to the function name, there should be a 'return' if



Home | Main Index | Thread Index | Old Index