aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-utils.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-12-26 11:05:57 -0700
committerTom Tromey <tom@tromey.com>2018-12-27 10:50:43 -0700
commit075c55e0cc0a68eeab777027213c2f545618e844 (patch)
treed5ff42efac40742af8ce1401ef36ae43fc4df79d /gdb/python/py-utils.c
parent293bf1a719e88e063e75ae467c5aec101b59fbf6 (diff)
downloadgdb-075c55e0cc0a68eeab777027213c2f545618e844.zip
gdb-075c55e0cc0a68eeab777027213c2f545618e844.tar.gz
gdb-075c55e0cc0a68eeab777027213c2f545618e844.tar.bz2
Remove more calls to xfree from Python
This changes the Python code to remove some more calls to xfree, in favor of self-managing data structures. Tested on x86-64 Fedora 28. gdb/ChangeLog 2018-12-27 Tom Tromey <tom@tromey.com> * python/python.c (python_interactive_command): Use std::string. (gdbpy_parameter): Likewise. * python/py-utils.c (unicode_to_encoded_string): Update comment. * python/py-symtab.c (salpy_str): Use PyString_FromFormat. * python/py-record-btrace.c (recpy_bt_insn_data): Use byte_vector. * python/py-objfile.c (objfpy_get_build_id): Use unique_xmalloc_ptr. * python/py-inferior.c (infpy_read_memory): Use unique_xmalloc_ptr. * python/py-cmd.c (gdbpy_parse_command_name): Use std::string.
Diffstat (limited to 'gdb/python/py-utils.c')
-rw-r--r--gdb/python/py-utils.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c
index 2b47790..e0aedb5 100644
--- a/gdb/python/py-utils.c
+++ b/gdb/python/py-utils.c
@@ -62,9 +62,8 @@ python_string_to_unicode (PyObject *obj)
/* Returns a newly allocated string with the contents of the given unicode
string object converted to CHARSET. If an error occurs during the
- conversion, NULL will be returned and a python exception will be set.
-
- The caller is responsible for xfree'ing the string. */
+ conversion, NULL will be returned and a python exception will be
+ set. */
static gdb::unique_xmalloc_ptr<char>
unicode_to_encoded_string (PyObject *unicode_str, const char *charset)
{