mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-12 09:39:30 +08:00
gdb: add constructor to internalvar
Add a constructor that takes the name as a parameter. Initialize the next and kind fields inline. Change-Id: Ic4db0aba85f1da9f12f3eee0ac62c0e5ef0cfe88 Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
12
gdb/value.c
12
gdb/value.c
@ -1829,14 +1829,18 @@ union internalvar_data
|
|||||||
|
|
||||||
struct internalvar
|
struct internalvar
|
||||||
{
|
{
|
||||||
struct internalvar *next;
|
internalvar (std::string name)
|
||||||
|
: name (std::move (name))
|
||||||
|
{}
|
||||||
|
|
||||||
|
struct internalvar *next = nullptr;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
/* We support various different kinds of content of an internal variable.
|
/* We support various different kinds of content of an internal variable.
|
||||||
enum internalvar_kind specifies the kind, and union internalvar_data
|
enum internalvar_kind specifies the kind, and union internalvar_data
|
||||||
provides the data associated with this particular kind. */
|
provides the data associated with this particular kind. */
|
||||||
|
|
||||||
enum internalvar_kind kind;
|
enum internalvar_kind kind = INTERNALVAR_VOID;
|
||||||
|
|
||||||
union internalvar_data u;
|
union internalvar_data u;
|
||||||
};
|
};
|
||||||
@ -1922,10 +1926,8 @@ complete_internalvar (completion_tracker &tracker, const char *name)
|
|||||||
struct internalvar *
|
struct internalvar *
|
||||||
create_internalvar (const char *name)
|
create_internalvar (const char *name)
|
||||||
{
|
{
|
||||||
internalvar *var = new internalvar;
|
internalvar *var = new internalvar (name);
|
||||||
|
|
||||||
var->name = name;
|
|
||||||
var->kind = INTERNALVAR_VOID;
|
|
||||||
var->next = internalvars;
|
var->next = internalvars;
|
||||||
internalvars = var;
|
internalvars = var;
|
||||||
return var;
|
return var;
|
||||||
|
Reference in New Issue
Block a user