]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Convert mdebugread.c to type-safe registry API
authorTom Tromey <tom@tromey.com>
Wed, 1 May 2019 21:31:10 +0000 (15:31 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 8 May 2019 22:01:54 +0000 (16:01 -0600)
This changes mdebugread.c to use the type-safe registry API.

gdb/ChangeLog
2019-05-08  Tom Tromey  <tom@tromey.com>

* mdebugread.c (basic_type_data): Change type.
(basic_type, _initialize_mdebugread): Update.

gdb/ChangeLog
gdb/mdebugread.c

index edda8c918e0d3dc202332e81272ae9daa5b37d93..4f1859c981db353e756f5f24ba5bbf123fd7e338 100644 (file)
@@ -1,3 +1,8 @@
+2019-05-08  Tom Tromey  <tom@tromey.com>
+
+       * mdebugread.c (basic_type_data): Change type.
+       (basic_type, _initialize_mdebugread): Update.
+
 2019-05-08  Tom Tromey  <tom@tromey.com>
 
        * common/gdb_unique_ptr.h (struct noop_deleter): New.
index 35e7890f3574beda2b4c3579536fbfa8ba28204b..2b54fef051aa74e01efd3a2880e878f6909f3c23 100644 (file)
@@ -1358,14 +1358,15 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
 
 /* Basic types.  */
 
-static const struct objfile_data *basic_type_data;
+static const struct objfile_key<struct type *,
+                               gdb::noop_deleter<struct type *>>
+  basic_type_data;
 
 static struct type *
 basic_type (int bt, struct objfile *objfile)
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct type **map_bt
-    = (struct type **) objfile_data (objfile, basic_type_data);
+  struct type **map_bt = basic_type_data.get (objfile);
   struct type *tp;
 
   if (bt >= btMax)
@@ -1375,7 +1376,7 @@ basic_type (int bt, struct objfile *objfile)
     {
       map_bt = OBSTACK_CALLOC (&objfile->objfile_obstack,
                               btMax, struct type *);
-      set_objfile_data (objfile, basic_type_data, map_bt);
+      basic_type_data.set (objfile, map_bt);
     }
 
   if (map_bt[bt])
@@ -4811,8 +4812,6 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
 void
 _initialize_mdebugread (void)
 {
-  basic_type_data = register_objfile_data ();
-
   mdebug_register_index
     = register_symbol_register_impl (LOC_REGISTER, &mdebug_register_funcs);
   mdebug_regparm_index