Use std::vector in gdb_bfd_data
authorTom Tromey <tom@tromey.com>
Sun, 15 Oct 2017 17:31:46 +0000 (11:31 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 20 Oct 2017 15:01:04 +0000 (09:01 -0600)
This changes gdb_bfd_data to use std::vector rather than VEC.

ChangeLog
2017-10-20  Tom Tromey  <tom@tromey.com>

* gdb_bfd.c (struct gdb_bfd_data) <included_bfds>: Now a
std::vector.
(gdb_bfd_record_inclusion): Update.
(bfdp): Remove typedef.

gdb/ChangeLog
gdb/gdb_bfd.c

index 97fcde2196bc921d01c6c2a52276f80b0aff4ff4..e6e1d029ea24a1513667e4adc87b067961f5c0ff 100644 (file)
@@ -1,3 +1,10 @@
+2017-10-20  Tom Tromey  <tom@tromey.com>
+
+       * gdb_bfd.c (struct gdb_bfd_data) <included_bfds>: Now a
+       std::vector.
+       (gdb_bfd_record_inclusion): Update.
+       (bfdp): Remove typedef.
+
 2017-10-20  Tom Tromey  <tom@tromey.com>
 
        * gdb_bfd.c (gdb_bfd_ref): Use new.
index b60d237635a124e5e5fd3bca112ec5b147f1181d..cc02740c1a63b662516e1ed79f0152701d37dcc9 100644 (file)
@@ -34,9 +34,6 @@
 #include "gdb/fileio.h"
 #include "inferior.h"
 
-typedef bfd *bfdp;
-DEF_VEC_P (bfdp);
-
 /* An object of this type is stored in the section's user data when
    mapping a section.  */
 
@@ -87,14 +84,6 @@ struct gdb_bfd_data
 
   ~gdb_bfd_data ()
   {
-    int ix;
-    bfd *included_bfd;
-
-    for (ix = 0;
-        VEC_iterate (bfdp, included_bfds, ix, included_bfd);
-        ++ix)
-      gdb_bfd_unref (included_bfd);
-    VEC_free (bfdp, included_bfds);
   }
 
   /* The reference count.  */
@@ -130,7 +119,7 @@ struct gdb_bfd_data
   bfd *archive_bfd = nullptr;
 
   /* Table of all the bfds this bfd has included.  */
-  VEC (bfdp) *included_bfds = nullptr;
+  std::vector<gdb_bfd_ref_ptr> included_bfds;
 
   /* The registry.  */
   REGISTRY_FIELDS = {};
@@ -875,9 +864,8 @@ gdb_bfd_record_inclusion (bfd *includer, bfd *includee)
 {
   struct gdb_bfd_data *gdata;
 
-  gdb_bfd_ref (includee);
   gdata = (struct gdb_bfd_data *) bfd_usrdata (includer);
-  VEC_safe_push (bfdp, gdata->included_bfds, includee);
+  gdata->included_bfds.push_back (new_bfd_ref (includee));
 }
 
 /* See gdb_bfd.h.  */
This page took 0.035805 seconds and 4 git commands to generate.