summaryrefslogtreecommitdiff
path: root/gdb/python/py-value.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-11-08 15:26:45 +0000
committerPedro Alves <palves@redhat.com>2016-11-08 15:26:45 +0000
commitc92aed165e8af79f51c5165f98f12389bb59a121 (patch)
tree68b7aecd264ec7bcdc148d5a71c7459a62c03a09 /gdb/python/py-value.c
parent02030646c2a799614d31e52008403d8be067ac5d (diff)
downloadbinutils-gdb-c92aed165e8af79f51c5165f98f12389bb59a121.tar.gz
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.
Diffstat (limited to 'gdb/python/py-value.c')
-rw-r--r--gdb/python/py-value.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index f8bf17af459..926a09c8512 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -896,7 +896,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
static PyObject *
valpy_str (PyObject *self)
{
- char *s = NULL;
+ std::string s;
PyObject *result;
struct value_print_options opts;
@@ -910,7 +910,7 @@ valpy_str (PyObject *self)
common_val_print (((value_object *) self)->value, stb, 0,
&opts, python_language);
- s = ui_file_xstrdup (stb, NULL);
+ s = ui_file_as_string (stb);
do_cleanups (old_chain);
}
@@ -920,8 +920,7 @@ valpy_str (PyObject *self)
}
END_CATCH
- result = PyUnicode_Decode (s, strlen (s), host_charset (), NULL);
- xfree (s);
+ result = PyUnicode_Decode (s.c_str (), s.length (), host_charset (), NULL);
return result;
}