From c92aed165e8af79f51c5165f98f12389bb59a121 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 8 Nov 2016 15:26:45 +0000 Subject: Use ui_file_as_string in gdb/python/ gdb/ChangeLog: 2016-11-08 Pedro Alves * 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. --- gdb/python/py-frame.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'gdb/python/py-frame.c') diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 6bdac08..a66f885 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -80,17 +80,13 @@ frame_object_to_frame_info (PyObject *obj) static PyObject * frapy_str (PyObject *self) { - char *s; PyObject *result; struct ui_file *strfile; strfile = mem_fileopen (); fprint_frame_id (strfile, ((frame_object *) self)->frame_id); - s = ui_file_xstrdup (strfile, NULL); - result = PyString_FromString (s); - xfree (s); - - return result; + std::string s = ui_file_as_string (strfile); + return PyString_FromString (s.c_str ()); } /* Implementation of gdb.Frame.is_valid (self) -> Boolean. -- cgit v1.1