aboutsummaryrefslogtreecommitdiff
path: root/gdb/serial.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-12-06 10:58:50 -0700
committerTom Tromey <tromey@redhat.com>2013-12-19 08:50:46 -0700
commitfcd488ca4e57141ac8ad28b6a5f560f3b9753a67 (patch)
tree9ddf9dc34ee2b40684c7a87372439e17745c5935 /gdb/serial.h
parentd493b2839b90ba7f4b5200505f94e45268777d7b (diff)
downloadgdb-fcd488ca4e57141ac8ad28b6a5f560f3b9753a67.zip
gdb-fcd488ca4e57141ac8ad28b6a5f560f3b9753a67.tar.gz
gdb-fcd488ca4e57141ac8ad28b6a5f560f3b9753a67.tar.bz2
make serial_ops const
I noticed that the serial_ops vtable is not const, but really it ought to be. This patch constifies it, removing the only mutable field in the process. Tested by rebuilding on x86-64 Fedora 18, both natively and using the mingw cross tools. 2013-12-19 Tom Tromey <tromey@redhat.com> * serial.c (serial_ops_p): New typedef. (serial_ops_list): Now a VEC. (serial_interface_lookup): Return const. Use VEC_iterate. (serial_add_interface): Make parameter const. (serial_open): Update. (serial_fdopen_ops): Make 'ops' const. (serial_pipe): Update. * ser-tcp.c (_initialize_ser_tcp): Update. * ser-pipe.c (_initialize_ser_pipe): Update. * ser-unix.c (_initialize_ser_hardwire): Update. * ser-mingw.c (_initialize_ser_windows): Update. * ser-go32.c (dos_ops): Now const. Update. * serial.h (struct serial) <ops>: Now const. (struct serial_ops) <next>: Remove. (serial_add_interface): Make parameter const.
Diffstat (limited to 'gdb/serial.h')
-rw-r--r--gdb/serial.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/serial.h b/gdb/serial.h
index 7a97e28..86c3960 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -228,7 +228,7 @@ struct serial
If != -1, this descriptor should be non-blocking or
ops->avail should be non-NULL. */
int error_fd;
- struct serial_ops *ops; /* Function vector */
+ const struct serial_ops *ops; /* Function vector */
void *state; /* Local context info for open FD */
serial_ttystate ttystate; /* Not used (yet) */
int bufcnt; /* Amount of data remaining in receive
@@ -251,7 +251,6 @@ struct serial
struct serial_ops
{
char *name;
- struct serial_ops *next;
int (*open) (struct serial *, const char *name);
void (*close) (struct serial *);
int (*fdopen) (struct serial *, int fd);
@@ -301,7 +300,7 @@ struct serial_ops
/* Add a new serial interface to the interface list. */
-extern void serial_add_interface (struct serial_ops * optable);
+extern void serial_add_interface (const struct serial_ops * optable);
/* File in which to record the remote debugging session. */