lint: merge duplicate code in initialization
No functional change.
This commit is contained in:
parent
ae661a2bff
commit
ebecd520af
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: init.c,v 1.134 2021/03/26 20:31:07 rillig Exp $ */
|
/* $NetBSD: init.c,v 1.135 2021/03/27 13:08:20 rillig Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: init.c,v 1.134 2021/03/26 20:31:07 rillig Exp $");
|
__RCSID("$NetBSD: init.c,v 1.135 2021/03/27 13:08:20 rillig Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -215,8 +215,9 @@ typedef struct initstack_element {
|
|||||||
} initstack_element;
|
} initstack_element;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Leads the path to the sub-object to initialize using the expression.
|
* A single component on the path to the sub-object that is initialized by an
|
||||||
* Example designators are '.member' or '.member[123].member.member[1][1]'.
|
* initializer expression. Either a struct or union member, or an array
|
||||||
|
* subscript.
|
||||||
*
|
*
|
||||||
* See also: C99 6.7.8 "Initialization"
|
* See also: C99 6.7.8 "Initialization"
|
||||||
*/
|
*/
|
||||||
@ -227,6 +228,10 @@ typedef struct designator {
|
|||||||
} designator;
|
} designator;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* The optional designation for an initializer, saying which sub-object to
|
||||||
|
* initialize. Examples for designations are '.member' or
|
||||||
|
* '.member[123].member.member[1][1]'.
|
||||||
|
*
|
||||||
* See also: C99 6.7.8 "Initialization"
|
* See also: C99 6.7.8 "Initialization"
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -265,27 +270,29 @@ static struct initialization *init;
|
|||||||
static bool init_array_using_string(tnode_t *);
|
static bool init_array_using_string(tnode_t *);
|
||||||
|
|
||||||
|
|
||||||
/* TODO: replace the following functions with current_init */
|
static struct initialization *
|
||||||
|
current_init(void)
|
||||||
|
{
|
||||||
|
lint_assert(init != NULL);
|
||||||
|
return init;
|
||||||
|
}
|
||||||
|
|
||||||
bool *
|
bool *
|
||||||
current_initerr(void)
|
current_initerr(void)
|
||||||
{
|
{
|
||||||
lint_assert(init != NULL);
|
return ¤t_init()->initerr;
|
||||||
return &init->initerr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sym_t **
|
sym_t **
|
||||||
current_initsym(void)
|
current_initsym(void)
|
||||||
{
|
{
|
||||||
lint_assert(init != NULL);
|
return ¤t_init()->initsym;
|
||||||
return &init->initsym;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static designation *
|
static designation *
|
||||||
current_designation_mod(void)
|
current_designation_mod(void)
|
||||||
{
|
{
|
||||||
lint_assert(init != NULL);
|
return ¤t_init()->designation;
|
||||||
return &init->designation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static designation
|
static designation
|
||||||
@ -297,15 +304,13 @@ current_designation(void)
|
|||||||
static const initstack_element *
|
static const initstack_element *
|
||||||
current_initstk(void)
|
current_initstk(void)
|
||||||
{
|
{
|
||||||
lint_assert(init != NULL);
|
return current_init()->initstk;
|
||||||
return init->initstk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static initstack_element **
|
static initstack_element **
|
||||||
current_initstk_lvalue(void)
|
current_initstk_lvalue(void)
|
||||||
{
|
{
|
||||||
lint_assert(init != NULL);
|
return ¤t_init()->initstk;
|
||||||
return &init->initstk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user