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

* language.c (add_language): Use ui_file_as_string and adjust to
use std::string.

gdb/ChangeLog
gdb/language.c

index 883114f149fe11c593b75c471b6882adaf7ba463..ed6f160270997156af760eebd6462fd00055ca05 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-08  Pedro Alves  <palves@redhat.com>
+
+       * language.c (add_language): Use ui_file_as_string and adjust to
+       use std::string.
+
 2016-11-08  Pedro Alves  <palves@redhat.com>
            Tom Tromey  <tom@tromey.com>
 
index 39faecc4df8bbe50687bbd098d9a3a68cd20c0de..2869d75eedb5e25a4e1556962a31cff6d69eb2db 100644 (file)
@@ -538,7 +538,6 @@ add_language (const struct language_defn *lang)
   /* For the "set language" command.  */
   static const char **language_names = NULL;
   /* For the "help set language" command.  */
-  char *language_set_doc = NULL;
 
   int i;
   struct ui_file *tmp_stream;
@@ -609,19 +608,17 @@ add_language (const struct language_defn *lang)
                          languages[i]->la_name + 1);
     }
 
-  language_set_doc = ui_file_xstrdup (tmp_stream, NULL);
+  std::string language_set_doc = ui_file_as_string (tmp_stream);
   ui_file_delete (tmp_stream);
 
   add_setshow_enum_cmd ("language", class_support,
                        (const char **) language_names,
                        &language,
-                       language_set_doc,
+                       language_set_doc.c_str (),
                        _("Show the current source language."),
                        NULL, set_language_command,
                        show_language_command,
                        &setlist, &showlist);
-
-  xfree (language_set_doc);
 }
 
 /* Iterate through all registered languages looking for and calling