aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-objfile.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2016-03-29 23:48:35 -0700
committerDoug Evans <dje@google.com>2016-03-29 23:48:35 -0700
commit4ae6cc19626d010005fbfbfba72952d26cc7c728 (patch)
tree79b99d5476876b4bd92ac2d0f0b6c67589ca67ec /gdb/python/py-objfile.c
parent4ec9d7d56427e9fa49fd705599bb2ff0c3c5f3c1 (diff)
downloadbinutils-4ae6cc19626d010005fbfbfba72952d26cc7c728.zip
binutils-4ae6cc19626d010005fbfbfba72952d26cc7c728.tar.gz
binutils-4ae6cc19626d010005fbfbfba72952d26cc7c728.tar.bz2
python/py-utils.c (host_string_to_python_string): New function.
gdb/ChangeLog: * python/py-utils.c (host_string_to_python_string): New function. * python/python-internal.h (host_string_to_python_string): Declare it. * python/py-*.c (*): Update all calls to PyString_Decode (str, strlen (str), host_charset (), NULL); to use host_string_to_python_string instead.
Diffstat (limited to 'gdb/python/py-objfile.c')
-rw-r--r--gdb/python/py-objfile.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 89c1551..cd26c5b 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -78,9 +78,7 @@ objfpy_get_filename (PyObject *self, void *closure)
objfile_object *obj = (objfile_object *) self;
if (obj->objfile)
- return PyString_Decode (objfile_name (obj->objfile),
- strlen (objfile_name (obj->objfile)),
- host_charset (), NULL);
+ return host_string_to_python_string (objfile_name (obj->objfile));
Py_RETURN_NONE;
}
@@ -96,8 +94,7 @@ objfpy_get_username (PyObject *self, void *closure)
{
const char *username = obj->objfile->original_name;
- return PyString_Decode (username, strlen (username),
- host_charset (), NULL);
+ return host_string_to_python_string (username);
}
Py_RETURN_NONE;
@@ -152,8 +149,7 @@ objfpy_get_build_id (PyObject *self, void *closure)
char *hex_form = make_hex_string (build_id->data, build_id->size);
PyObject *result;
- result = PyString_Decode (hex_form, strlen (hex_form),
- host_charset (), NULL);
+ result = host_string_to_python_string (hex_form);
xfree (hex_form);
return result;
}