diff options
author | Tom Tromey <tom@tromey.com> | 2019-05-01 15:21:36 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-05-08 16:01:53 -0600 |
commit | bdb3ed9e634d3db8164d90dee12bc8b5e2458786 (patch) | |
tree | d1b744dd2e3842c92217e6398861e451490988aa /gdb/nto-tdep.c | |
parent | f37b313d5cafbed4e724db4724d1ab567b373be4 (diff) | |
download | gdb-bdb3ed9e634d3db8164d90dee12bc8b5e2458786.zip gdb-bdb3ed9e634d3db8164d90dee12bc8b5e2458786.tar.gz gdb-bdb3ed9e634d3db8164d90dee12bc8b5e2458786.tar.bz2 |
Convert nto-tdep.c to type-safe registry API
This changes nto-tdep.c to use the type-safe registry API.
gdb/ChangeLog
2019-05-08 Tom Tromey <tom@tromey.com>
* nto-tdep.c (nto_inferior_data_reg): Change type.
(nto_inferior_data): Update.
(nto_inferior_data_cleanup, nto_new_inferior_data)
(_initialize_nto_tdep): Remove.
* nto-tdep.h (struct nto_inferior_data): Add initializers.
Diffstat (limited to 'gdb/nto-tdep.c')
-rw-r--r-- | gdb/nto-tdep.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c index 0caa55c..48e731a 100644 --- a/gdb/nto-tdep.c +++ b/gdb/nto-tdep.c @@ -51,7 +51,8 @@ static char default_nto_target[] = ""; struct nto_target_ops current_nto_target; -static const struct inferior_data *nto_inferior_data_reg; +static const struct inferior_key<struct nto_inferior_data> + nto_inferior_data_reg; static char * nto_target (void) @@ -498,25 +499,6 @@ nto_read_auxv_from_initial_stack (CORE_ADDR initial_stack, gdb_byte *readbuf, return len_read; } -/* Allocate new nto_inferior_data object. */ - -static struct nto_inferior_data * -nto_new_inferior_data (void) -{ - struct nto_inferior_data *const inf_data - = XCNEW (struct nto_inferior_data); - - return inf_data; -} - -/* Free inferior data. */ - -static void -nto_inferior_data_cleanup (struct inferior *const inf, void *const dat) -{ - xfree (dat); -} - /* Return nto_inferior_data for the given INFERIOR. If not yet created, construct it. */ @@ -528,20 +510,9 @@ nto_inferior_data (struct inferior *const inferior) gdb_assert (inf != NULL); - inf_data - = (struct nto_inferior_data *) inferior_data (inf, nto_inferior_data_reg); + inf_data = nto_inferior_data_reg.get (inf); if (inf_data == NULL) - { - set_inferior_data (inf, nto_inferior_data_reg, - (inf_data = nto_new_inferior_data ())); - } + inf_data = nto_inferior_data_reg.emplace (inf); return inf_data; } - -void -_initialize_nto_tdep (void) -{ - nto_inferior_data_reg - = register_inferior_data_with_cleanup (NULL, nto_inferior_data_cleanup); -} |