Use ui_file_as_string in gdb/python/

gdb/ChangeLog:
2016-11-08  Pedro Alves  <palves@redhat.com>

	* python/py-arch.c (archpy_disassemble): Use ui_file_as_string and
	std::string.
	* python/py-breakpoint.c (bppy_get_commands): Use
	ui_file_as_string and std::string.
	* python/py-frame.c (frapy_str): Likewise.
	* python/py-type.c (typy_str): Likewise.
	* python/py-unwind.c (unwind_infopy_str): Likewise.
	* python/py-value.c (valpy_str): Likewise.
This commit is contained in:
Pedro Alves 2016-11-08 15:26:45 +00:00
parent 02030646c2
commit c92aed165e
7 changed files with 30 additions and 31 deletions

View file

@ -1010,8 +1010,7 @@ typy_template_argument (PyObject *self, PyObject *args)
static PyObject *
typy_str (PyObject *self)
{
char *thetype = NULL;
long length = 0;
std::string thetype;
PyObject *result;
TRY
@ -1025,18 +1024,17 @@ typy_str (PyObject *self)
LA_PRINT_TYPE (type_object_to_type (self), "", stb, -1, 0,
&type_print_raw_options);
thetype = ui_file_xstrdup (stb, &length);
thetype = ui_file_as_string (stb);
do_cleanups (old_chain);
}
CATCH (except, RETURN_MASK_ALL)
{
xfree (thetype);
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
result = PyUnicode_Decode (thetype, length, host_charset (), NULL);
xfree (thetype);
result = PyUnicode_Decode (thetype.c_str (), thetype.length (),
host_charset (), NULL);
return result;
}