make MSYMBOL_VALUE_ADDRESS an rvalue
[deliverable/binutils-gdb.git] / gdb / serial.c
index f2a9648dead3b186b6ec7e7aafe83e3ebebd5d40..7471a6b5ab53073f5b6ff63a1e6f17c3ee2e6ab4 100644 (file)
@@ -1,6 +1,6 @@
 /* Generic serial interface routines
 
-   Copyright (C) 1992-2013 Free Software Foundation, Inc.
+   Copyright (C) 1992-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include <ctype.h>
 #include "serial.h"
-#include "gdb_string.h"
+#include <string.h>
 #include "gdbcmd.h"
 #include "cli/cli-utils.h"
 
@@ -30,9 +30,12 @@ extern void _initialize_serial (void);
 
 static unsigned int global_serial_debug_p;
 
-/* Linked list of serial I/O handlers.  */
+typedef const struct serial_ops *serial_ops_p;
+DEF_VEC_P (serial_ops_p);
 
-static struct serial_ops *serial_ops_list = NULL;
+/* Serial I/O handlers.  */
+
+VEC (serial_ops_p) *serial_ops_list = NULL;
 
 /* Pointer to list of scb's.  */
 
@@ -44,7 +47,7 @@ static struct serial *scb_base;
 static char *serial_logfile = NULL;
 static struct ui_file *serial_logfp = NULL;
 
-static struct serial_ops *serial_interface_lookup (const char *);
+static const struct serial_ops *serial_interface_lookup (const char *);
 static void serial_logchar (struct ui_file *stream,
                            int ch_type, int ch, int timeout);
 static const char logbase_hex[] = "hex";
@@ -127,7 +130,7 @@ serial_logchar (struct ui_file *stream, int ch_type, int ch, int timeout)
 }
 
 void
-serial_log_command (const char *cmd)
+serial_log_command (struct target_ops *self, const char *cmd)
 {
   if (!serial_logfp)
     return;
@@ -143,12 +146,13 @@ serial_log_command (const char *cmd)
 }
 
 \f
-static struct serial_ops *
+static const struct serial_ops *
 serial_interface_lookup (const char *name)
 {
-  struct serial_ops *ops;
+  const struct serial_ops *ops;
+  int i;
 
-  for (ops = serial_ops_list; ops; ops = ops->next)
+  for (i = 0; VEC_iterate (serial_ops_p, serial_ops_list, i, ops); ++i)
     if (strcmp (name, ops->name) == 0)
       return ops;
 
@@ -156,10 +160,9 @@ serial_interface_lookup (const char *name)
 }
 
 void
-serial_add_interface (struct serial_ops *optable)
+serial_add_interface (const struct serial_ops *optable)
 {
-  optable->next = serial_ops_list;
-  serial_ops_list = optable;
+  VEC_safe_push (serial_ops_p, serial_ops_list, optable);
 }
 
 /* Return the open serial device for FD, if found, or NULL if FD is
@@ -183,7 +186,7 @@ struct serial *
 serial_open (const char *name)
 {
   struct serial *scb;
-  struct serial_ops *ops;
+  const struct serial_ops *ops;
   const char *open_name = name;
 
   if (strcmp (name, "pc") == 0)
@@ -208,7 +211,7 @@ serial_open (const char *name)
   if (!ops)
     return NULL;
 
-  scb = XMALLOC (struct serial);
+  scb = XNEW (struct serial);
 
   scb->ops = ops;
 
@@ -246,7 +249,7 @@ serial_open (const char *name)
    interface ops OPS.  */
 
 static struct serial *
-serial_fdopen_ops (const int fd, struct serial_ops *ops)
+serial_fdopen_ops (const int fd, const struct serial_ops *ops)
 {
   struct serial *scb;
 
@@ -260,7 +263,7 @@ serial_fdopen_ops (const int fd, struct serial_ops *ops)
   if (!ops)
     return NULL;
 
-  scb = XCALLOC (1, struct serial);
+  scb = XCNEW (struct serial);
 
   scb->ops = ops;
 
@@ -584,7 +587,7 @@ serial_done_wait_handle (struct serial *scb)
 int
 serial_pipe (struct serial *scbs[2])
 {
-  struct serial_ops *ops;
+  const struct serial_ops *ops;
   int fildes[2];
 
   ops = serial_interface_lookup ("pipe");
This page took 0.028026 seconds and 4 git commands to generate.