diff options
author | Tom Tromey <tom@tromey.com> | 2017-09-09 10:17:11 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-09-11 16:15:12 -0600 |
commit | 50feb4bd435b86c73ea55049b7cf87cc709c1388 (patch) | |
tree | e59ae0588b92fda4740cee2ade61c7435e81b948 | |
parent | c6dc63a16299e22fcb5bc13b34cb402a1bfcf6b9 (diff) | |
download | gdb-50feb4bd435b86c73ea55049b7cf87cc709c1388.zip gdb-50feb4bd435b86c73ea55049b7cf87cc709c1388.tar.gz gdb-50feb4bd435b86c73ea55049b7cf87cc709c1388.tar.bz2 |
Use std::string in ctf_start
This changes ctf_start to use std::string, allowing for some cleanup
removal.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* ctf.c (ctf_start): Use std::string.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/ctf.c | 18 |
2 files changed, 10 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6a5344a..6534131 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2017-09-11 Tom Tromey <tom@tromey.com> + * ctf.c (ctf_start): Use std::string. + +2017-09-11 Tom Tromey <tom@tromey.com> + * ada-lang.c (is_known_support_routine): Update. (ada_unhandled_exception_name_addr_from_raise): Update. * guile/scm-frame.c (gdbscm_frame_name): Update. @@ -311,8 +311,6 @@ ctf_target_save (struct trace_file_writer *self, static void ctf_start (struct trace_file_writer *self, const char *dirname) { - char *file_name; - struct cleanup *old_chain; struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self; int i; @@ -325,24 +323,20 @@ ctf_start (struct trace_file_writer *self, const char *dirname) memset (&writer->tcs, '\0', sizeof (writer->tcs)); - file_name = xstrprintf ("%s/%s", dirname, CTF_METADATA_NAME); - old_chain = make_cleanup (xfree, file_name); + std::string file_name = string_printf ("%s/%s", dirname, CTF_METADATA_NAME); - writer->tcs.metadata_fd = fopen (file_name, "w"); + writer->tcs.metadata_fd = fopen (file_name.c_str (), "w"); if (writer->tcs.metadata_fd == NULL) error (_("Unable to open file '%s' for saving trace data (%s)"), - file_name, safe_strerror (errno)); - do_cleanups (old_chain); + file_name.c_str (), safe_strerror (errno)); ctf_save_metadata_header (&writer->tcs); - file_name = xstrprintf ("%s/%s", dirname, CTF_DATASTREAM_NAME); - old_chain = make_cleanup (xfree, file_name); - writer->tcs.datastream_fd = fopen (file_name, "w"); + file_name = string_printf ("%s/%s", dirname, CTF_DATASTREAM_NAME); + writer->tcs.datastream_fd = fopen (file_name.c_str (), "w"); if (writer->tcs.datastream_fd == NULL) error (_("Unable to open file '%s' for saving trace data (%s)"), - file_name, safe_strerror (errno)); - do_cleanups (old_chain); + file_name.c_str (), safe_strerror (errno)); } /* This is the implementation of trace_file_write_ops method |