Use ui_file_as_string in gdb/cli/cli-setshow.c
authorPedro Alves <palves@redhat.com>
Tue, 8 Nov 2016 15:26:45 +0000 (15:26 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 8 Nov 2016 15:26:45 +0000 (15:26 +0000)
gdb/ChangeLog:
2016-11-08  Pedro Alves  <palves@redhat.com>

* cli/cli-setshow.c (do_show_command): Adjust to use
ui_file_as_string and std::string.

gdb/ChangeLog
gdb/cli/cli-setshow.c

index 51a12069611746a291dddc032c1e9ba58ec1f961..ae21b12d33762c420e9f89a22ac57ea7b6c257c9 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-08  Pedro Alves  <palves@redhat.com>
+
+       * cli/cli-setshow.c (do_show_command): Adjust to use
+       ui_file_as_string and std::string.
+
 2016-11-08  Pedro Alves  <palves@redhat.com>
 
        * remote.c (escape_buffer): Use ui_file_as_string and return
index eb17158dcb9955294df5b266a34b3040c430419f..d2ec1dfb33d04e23b7be29d052e468e027cbb2ba 100644 (file)
@@ -653,13 +653,12 @@ do_show_command (const char *arg, int from_tty, struct cmd_list_element *c)
     ui_out_field_stream (uiout, "value", stb);
   else
     {
-      char *value = ui_file_xstrdup (stb, NULL);
+      std::string value = ui_file_as_string (stb);
 
-      make_cleanup (xfree, value);
       if (c->show_value_func != NULL)
-       c->show_value_func (gdb_stdout, from_tty, c, value);
+       c->show_value_func (gdb_stdout, from_tty, c, value.c_str ());
       else
-       deprecated_show_value_hack (gdb_stdout, from_tty, c, value);
+       deprecated_show_value_hack (gdb_stdout, from_tty, c, value.c_str ());
     }
   do_cleanups (old_chain);