This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Remove a VEC from serial.c
- From: Tom Tromey <tromey at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 9 Jun 2018 22:08:21 -0000
- Subject: [binutils-gdb] Remove a VEC from serial.c
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=191cca638351fcaf9bee93a396bd4f8b74f915eb
commit 191cca638351fcaf9bee93a396bd4f8b74f915eb
Author: Tom Tromey <tom@tromey.com>
Date: Thu Jun 7 17:25:41 2018 -0600
Remove a VEC from serial.c
This replaces a VEC in serial.c with a std::vector.
Tested by the buildbot.
gdb/ChangeLog
2018-06-09 Tom Tromey <tom@tromey.com>
* serial.c (serial_ops_p): Remove typedef. Don't declare VEC.
(serial_ops_list): Now static, std::vector.
(serial_interface_lookup, serial_add_interface): Update.
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/serial.c | 12 +++---------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c12ecc3..5233704 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2018-06-09 Tom Tromey <tom@tromey.com>
+ * serial.c (serial_ops_p): Remove typedef. Don't declare VEC.
+ (serial_ops_list): Now static, std::vector.
+ (serial_interface_lookup, serial_add_interface): Update.
+
+2018-06-09 Tom Tromey <tom@tromey.com>
+
* dwarf2read.c (process_cu_includes): Update.
(process_full_comp_unit): Update.
* dwarf2read.h (struct dwarf2_per_objfile) <just_read_cus>: Now a
diff --git a/gdb/serial.c b/gdb/serial.c
index 48fb02d..16308ab 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -27,12 +27,9 @@
static unsigned int global_serial_debug_p;
-typedef const struct serial_ops *serial_ops_p;
-DEF_VEC_P (serial_ops_p);
-
/* Serial I/O handlers. */
-VEC (serial_ops_p) *serial_ops_list = NULL;
+static std::vector<const struct serial_ops *> serial_ops_list;
/* Pointer to list of scb's. */
@@ -146,10 +143,7 @@ serial_log_command (struct target_ops *self, const char *cmd)
static const struct serial_ops *
serial_interface_lookup (const char *name)
{
- const struct serial_ops *ops;
- int i;
-
- for (i = 0; VEC_iterate (serial_ops_p, serial_ops_list, i, ops); ++i)
+ for (const struct serial_ops *ops : serial_ops_list)
if (strcmp (name, ops->name) == 0)
return ops;
@@ -159,7 +153,7 @@ serial_interface_lookup (const char *name)
void
serial_add_interface (const struct serial_ops *optable)
{
- VEC_safe_push (serial_ops_p, serial_ops_list, optable);
+ serial_ops_list.push_back (optable);
}
/* Return the open serial device for FD, if found, or NULL if FD is