diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2018-08-22 10:55:28 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-08-22 10:55:28 -0400 |
commit | 467dc1e2ea5a8b300b61194aa8565829ce7d65bc (patch) | |
tree | 8e7a937f9c0a1c739b9d2bef6ddd9c0a9a0dca38 /gdb/guile | |
parent | 6d52907e226ade45d5f5196eaed8386affda5156 (diff) | |
download | gdb-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/guile')
-rw-r--r-- | gdb/guile/scm-string.c | 6 | ||||
-rw-r--r-- | gdb/guile/scm-utils.c | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/gdb/guile/scm-string.c b/gdb/guile/scm-string.c index 5779509..d09a54d 100644 --- a/gdb/guile/scm-string.c +++ b/gdb/guile/scm-string.c @@ -62,14 +62,12 @@ SCM gdbscm_scm_from_printf (const char *format, ...) { va_list args; - char *string; SCM result; va_start (args, format); - string = xstrvprintf (format, args); + std::string string = string_vprintf (format, args); va_end (args); - result = scm_from_latin1_string (string); - xfree (string); + result = scm_from_latin1_string (string.c_str ()); return result; } diff --git a/gdb/guile/scm-utils.c b/gdb/guile/scm-utils.c index c514c82..f8603a7 100644 --- a/gdb/guile/scm-utils.c +++ b/gdb/guile/scm-utils.c @@ -79,13 +79,11 @@ void gdbscm_printf (SCM port, const char *format, ...) { va_list args; - char *string; va_start (args, format); - string = xstrvprintf (format, args); + std::string string = string_vprintf (format, args); va_end (args); - scm_puts (string, port); - xfree (string); + scm_puts (string.c_str (), port); } /* Utility for calling from gdb to "display" an SCM object. */ |