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 struct members in init.c
details: https://anonhg.NetBSD.org/src/rev/0de5910caa4a
branches: trunk
changeset: 954124:0de5910caa4a
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Mar 29 20:52:00 2021 +0000
description:
lint: rename struct members in init.c
No functional change.
diffstat:
usr.bin/xlint/lint1/init.c | 226 ++++++++++++++++++++++----------------------
1 files changed, 114 insertions(+), 112 deletions(-)
diffs (truncated from 614 to 300 lines):
diff -r 05e60503b7eb -r 0de5910caa4a usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c Mon Mar 29 20:39:18 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c Mon Mar 29 20:52:00 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.175 2021/03/29 20:39:18 rillig Exp $ */
+/* $NetBSD: init.c,v 1.176 2021/03/29 20:52:00 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.175 2021/03/29 20:39:18 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.176 2021/03/29 20:52:00 rillig Exp $");
#endif
#include <stdlib.h>
@@ -216,9 +216,9 @@
* See also: C99 6.7.8 "Initialization"
*/
struct designator {
- const char *name; /* for struct and union */
- /* TODO: add 'subscript' for arrays */
- struct designator *next;
+ const char *dr_name; /* for struct and union */
+ /* TODO: add 'dr_subscript' for arrays */
+ struct designator *dr_next;
};
/*
@@ -229,8 +229,8 @@
* See also: C99 6.7.8 "Initialization"
*/
struct designation {
- struct designator *head;
- struct designator *tail;
+ struct designator *dn_head;
+ struct designator *dn_tail;
};
struct initialization {
@@ -240,21 +240,21 @@
* (parsed by yacc, expression trees built, but no initialization
* takes place).
*/
- bool initerr;
+ bool in_err;
/* The symbol that is to be initialized. */
- sym_t *initsym;
+ sym_t *in_sym;
/* The innermost brace level. */
- struct brace_level *brace_level;
+ struct brace_level *in_brace_level;
/*
* The C99 designator, if any, for the current initialization
* expression.
*/
- struct designation designation;
+ struct designation in_designation;
- struct initialization *next;
+ struct initialization *in_next;
};
@@ -425,16 +425,18 @@
static struct designator *
designator_new(const char *name)
{
- struct designator *d = xcalloc(1, sizeof *d);
- d->name = name;
- return d;
+ struct designator *dr;
+
+ dr = xcalloc(1, sizeof *dr);
+ dr->dr_name = name;
+ return dr;
}
static void
-designator_free(struct designator *d)
+designator_free(struct designator *dr)
{
- free(d);
+ free(dr);
}
@@ -442,15 +444,15 @@
static void
designation_debug(const struct designation *dn)
{
- const struct designator *p;
+ const struct designator *dr;
- if (dn->head == NULL)
+ if (dn->dn_head == NULL)
return;
debug_indent();
debug_printf("designation: ");
- for (p = dn->head; p != NULL; p = p->next)
- debug_printf(".%s", p->name);
+ for (dr = dn->dn_head; dr != NULL; dr = dr->dr_next)
+ debug_printf(".%s", dr->dr_name);
debug_printf("\n");
}
#else
@@ -461,12 +463,12 @@
designation_add(struct designation *dn, struct designator *dr)
{
- if (dn->head != NULL) {
- dn->tail->next = dr;
- dn->tail = dr;
+ if (dn->dn_head != NULL) {
+ dn->dn_tail->dr_next = dr;
+ dn->dn_tail = dr;
} else {
- dn->head = dr;
- dn->tail = dr;
+ dn->dn_head = dr;
+ dn->dn_tail = dr;
}
designation_debug(dn);
@@ -480,15 +482,15 @@
static void
designation_shift_level(struct designation *dn)
{
- lint_assert(dn->head != NULL);
+ lint_assert(dn->dn_head != NULL);
- if (dn->head == dn->tail) {
- designator_free(dn->head);
- dn->head = NULL;
- dn->tail = NULL;
+ if (dn->dn_head == dn->dn_tail) {
+ designator_free(dn->dn_head);
+ dn->dn_head = NULL;
+ dn->dn_tail = NULL;
} else {
- struct designator *head = dn->head;
- dn->head = dn->head->next;
+ struct designator *head = dn->dn_head;
+ dn->dn_head = dn->dn_head->dr_next;
designator_free(head);
}
@@ -765,7 +767,7 @@
{
struct initialization *in = xcalloc(1, sizeof(*in));
- in->initsym = sym;
+ in->in_sym = sym;
return in;
}
@@ -773,11 +775,11 @@
static void
initialization_free(struct initialization *in)
{
- struct brace_level *level, *next;
+ struct brace_level *bl, *next;
- for (level = in->brace_level; level != NULL; level = next) {
- next = level->bl_enclosing;
- brace_level_free(level);
+ for (bl = in->in_brace_level; bl != NULL; bl = next) {
+ next = bl->bl_enclosing;
+ brace_level_free(bl);
}
free(in);
@@ -790,13 +792,13 @@
static void
initialization_debug(const struct initialization *in)
{
- if (in->brace_level == NULL) {
+ if (in->in_brace_level == NULL) {
debug_step("no brace level in the current initialization");
return;
}
size_t i = 0;
- for (const struct brace_level *level = in->brace_level;
+ for (const struct brace_level *level = in->in_brace_level;
level != NULL; level = level->bl_enclosing) {
debug_indent();
debug_printf("brace level %zu: ", i);
@@ -817,7 +819,7 @@
static void
initialization_init(struct initialization *in)
{
- if (in->initerr)
+ if (in->in_err)
return;
debug_enter();
@@ -826,11 +828,11 @@
* If the type which is to be initialized is an incomplete array,
* it must be duplicated.
*/
- if (in->initsym->s_type->t_tspec == ARRAY && is_incomplete(in->initsym->s_type))
- in->initsym->s_type = duptyp(in->initsym->s_type);
+ if (in->in_sym->s_type->t_tspec == ARRAY && is_incomplete(in->in_sym->s_type))
+ in->in_sym->s_type = duptyp(in->in_sym->s_type);
/* TODO: does 'duptyp' create a memory leak? */
- in->brace_level = brace_level_new(NULL, in->initsym->s_type, 1, NULL);
+ in->in_brace_level = brace_level_new(NULL, in->in_sym->s_type, 1, NULL);
initialization_debug(in);
debug_leave();
@@ -839,7 +841,7 @@
static void
initialization_set_error(struct initialization *in)
{
- in->initerr = true;
+ in->in_err = true;
}
/* TODO: document me */
@@ -847,7 +849,7 @@
static bool
initialization_push_struct_or_union(struct initialization *in)
{
- struct brace_level *level = in->brace_level;
+ struct brace_level *level = in->in_brace_level;
int cnt;
sym_t *m;
@@ -859,18 +861,18 @@
}
cnt = 0;
- designation_debug(&in->designation);
+ designation_debug(&in->in_designation);
debug_step("lookup for '%s'%s",
type_name(level->bl_type),
level->bl_seen_named_member ? ", seen named member" : "");
- if (in->designation.head != NULL)
+ if (in->in_designation.dn_head != NULL)
m = brace_level_look_up_first_member_named(level,
- in->designation.head->name, &cnt);
+ in->in_designation.dn_head->dr_name, &cnt);
else
m = brace_level_look_up_first_member_unnamed(level, &cnt);
- if (in->designation.head != NULL) {
+ if (in->in_designation.dn_head != NULL) {
if (m == NULL) {
debug_step("pop struct");
return true;
@@ -879,8 +881,8 @@
level->bl_subtype = m->s_type;
level->bl_seen_named_member = true;
debug_step("named member '%s'",
- in->designation.head->name);
- designation_shift_level(&in->designation);
+ in->in_designation.dn_head->dr_name);
+ designation_shift_level(&in->in_designation);
cnt = level->bl_type->t_tspec == STRUCT ? 2 : 1;
}
level->bl_brace = true;
@@ -901,8 +903,8 @@
static void
initialization_end_brace_level(struct initialization *in)
{
- struct brace_level *level = in->brace_level;
- in->brace_level = level->bl_enclosing;
+ struct brace_level *level = in->in_brace_level;
+ in->in_brace_level = level->bl_enclosing;
brace_level_free(level);
}
@@ -915,26 +917,26 @@
debug_enter();
- brace_level_extend_if_array_of_unknown_size(in->brace_level);
+ brace_level_extend_if_array_of_unknown_size(in->in_brace_level);
- level = in->brace_level;
+ level = in->in_brace_level;
lint_assert(level->bl_remaining > 0);
- in->brace_level = brace_level_new(brace_level_subtype(level), NULL, 0,
+ in->in_brace_level = brace_level_new(brace_level_subtype(level), NULL, 0,
level);
- lint_assert(in->brace_level->bl_type != NULL);
- lint_assert(in->brace_level->bl_type->t_tspec != FUNC);
+ lint_assert(in->in_brace_level->bl_type != NULL);
+ lint_assert(in->in_brace_level->bl_type->t_tspec != FUNC);
Home |
Main Index |
Thread Index |
Old Index