aboutsummaryrefslogtreecommitdiff
path: root/gdb/serial.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2018-08-22 10:55:28 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2018-08-22 10:55:28 -0400
commit467dc1e2ea5a8b300b61194aa8565829ce7d65bc (patch)
tree8e7a937f9c0a1c739b9d2bef6ddd9c0a9a0dca38 /gdb/serial.c
parent6d52907e226ade45d5f5196eaed8386affda5156 (diff)
downloadgdb-467dc1e2ea5a8b300b61194aa8565829ce7d65bc.zip
gdb-467dc1e2ea5a8b300b61194aa8565829ce7d65bc.tar.gz
gdb-467dc1e2ea5a8b300b61194aa8565829ce7d65bc.tar.bz2
Replace xstrvprintf usages with string_vprintf
Most usages of xstrvprintf in GDB can be replaced with string_vprintf, removing some manual memory management. gdb/ChangeLog: * guile/scm-string.c (gdbscm_scm_from_printf): Use string_vprintf. * guile/scm-utils.c (gdbscm_printf): Likewise. * serial.c (serial_printf): Likewise. * xml-support.c (gdb_xml_parser::vdebug): Likewise.
Diffstat (limited to 'gdb/serial.c')
-rw-r--r--gdb/serial.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/serial.c b/gdb/serial.c
index 0239fc8..fb2b212 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -434,16 +434,14 @@ serial_write (struct serial *scb, const void *buf, size_t count)
}
void
-serial_printf (struct serial *desc, const char *format,...)
+serial_printf (struct serial *desc, const char *format, ...)
{
va_list args;
- char *buf;
va_start (args, format);
- buf = xstrvprintf (format, args);
- serial_write (desc, buf, strlen (buf));
+ std::string buf = string_vprintf (format, args);
+ serial_write (desc, buf.c_str (), buf.length ());
- xfree (buf);
va_end (args);
}