aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-10-15 11:31:46 -0600
committerTom Tromey <tom@tromey.com>2017-10-20 09:01:04 -0600
commitd5833c62d93e8176b70e8509ab36cc38801c3ebd (patch)
treef7e374d2825a193014525f3feb4d9a04bf5f8e55
parent06d5bbc8e5f7541b13509c33b8b3eb8afac27b2f (diff)
downloadgdb-d5833c62d93e8176b70e8509ab36cc38801c3ebd.zip
gdb-d5833c62d93e8176b70e8509ab36cc38801c3ebd.tar.gz
gdb-d5833c62d93e8176b70e8509ab36cc38801c3ebd.tar.bz2
Use std::vector in gdb_bfd_data
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.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/gdb_bfd.c16
2 files changed, 9 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 97fcde2..e6e1d02 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
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.
(struct gdb_bfd_data): Add constructor, destructor, and member
initializers.
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index b60d237..cc02740 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -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. */