diff options
author | 2016-03-29 23:48:35 -0700 | |
---|---|---|
committer | 2016-03-29 23:48:35 -0700 | |
commit | 4ae6cc19626d010005fbfbfba72952d26cc7c728 (patch) | |
tree | 79b99d5476876b4bd92ac2d0f0b6c67589ca67ec /gdb/python/py-utils.c | |
parent | use xstrdup and friends more (diff) | |
download | binutils-gdb-4ae6cc19626d010005fbfbfba72952d26cc7c728.tar.gz binutils-gdb-4ae6cc19626d010005fbfbfba72952d26cc7c728.tar.bz2 binutils-gdb-4ae6cc19626d010005fbfbfba72952d26cc7c728.zip |
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-utils.c')
-rw-r--r-- | gdb/python/py-utils.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c index a7e79e3ac72..2e2121d6d68 100644 --- a/gdb/python/py-utils.c +++ b/gdb/python/py-utils.c @@ -221,6 +221,14 @@ python_string_to_host_string (PyObject *obj) return result; } +/* Convert a host string to a python string. */ + +PyObject * +host_string_to_python_string (const char *str) +{ + return PyString_Decode (str, strlen (str), host_charset (), NULL); +} + /* Return true if OBJ is a Python string or unicode object, false otherwise. */ |