diff options
author | Tom Tromey <tom@tromey.com> | 2022-06-01 13:13:28 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-08-04 13:28:04 -0600 |
commit | b987c79ac133c303adefad5caff19c530f86b7a4 (patch) | |
tree | e292a9b5a5d510d72162a000af1bedd568ae0f02 /gdb/arch-utils.c | |
parent | 0655397b573d93fe543d6ec4bd0e00e8b3ff5d81 (diff) | |
download | gdb-b987c79ac133c303adefad5caff19c530f86b7a4.zip gdb-b987c79ac133c303adefad5caff19c530f86b7a4.tar.gz gdb-b987c79ac133c303adefad5caff19c530f86b7a4.tar.bz2 |
Use new and delete for gdbarch
This changes gdbarch to use new and delete.
Diffstat (limited to 'gdb/arch-utils.c')
-rw-r--r-- | gdb/arch-utils.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index e92004f..295dfc2 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -1168,7 +1168,7 @@ pstring_list (const char *const *list) obstack *gdbarch_obstack (gdbarch *arch) { - return arch->obstack; + return &arch->obstack; } /* See gdbarch.h. */ @@ -1176,7 +1176,7 @@ obstack *gdbarch_obstack (gdbarch *arch) char * gdbarch_obstack_strdup (struct gdbarch *arch, const char *string) { - return obstack_strdup (arch->obstack, string); + return obstack_strdup (&arch->obstack, string); } @@ -1189,13 +1189,9 @@ gdbarch_obstack_strdup (struct gdbarch *arch, const char *string) void gdbarch_free (struct gdbarch *arch) { - struct obstack *obstack; - gdb_assert (arch != NULL); gdb_assert (!arch->initialized_p); - obstack = arch->obstack; - obstack_free (obstack, 0); /* Includes the ARCH. */ - xfree (obstack); + delete arch; } /* See gdbarch.h. */ @@ -1294,7 +1290,7 @@ gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data) the entire architecture, as that way it isn't possible for pre-init code to refer to undefined architecture fields. */ - gdbarch->data[data->index] = data->pre_init (gdbarch->obstack); + gdbarch->data[data->index] = data->pre_init (&gdbarch->obstack); else if (gdbarch->initialized_p && data->post_init != NULL) /* Post architecture creation: pass the entire architecture |