]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove a VEC from serial.c
authorTom Tromey <tom@tromey.com>
Thu, 7 Jun 2018 23:25:41 +0000 (17:25 -0600)
committerTom Tromey <tom@tromey.com>
Sat, 9 Jun 2018 22:07:57 +0000 (16:07 -0600)
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.

gdb/ChangeLog
gdb/serial.c

index c12ecc3facc34e76b65a739993a9c95f7c6268fc..52337042f1dc6c98826ae94ef99fb6704dd914a9 100644 (file)
@@ -1,3 +1,9 @@
+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.
index 48fb02d913b0f9dd82b61c2e4acdd34ae712e13a..16308ab9c72d8b8a903c3ce1bd53c11d717190c7 100644 (file)
 
 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