From 759ef83693911e20efd389b20cbf8f3a8eec30eb Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 14 Aug 2009 00:32:33 +0000 Subject: * ui-file.h (ui_file_xstrdup): Mention that the length argument may be NULL. * ui-file.c (ui_file_xstrdup): Don't dereference LENGTH if it is NULL. * aix-thread.c (aix_thread_extra_thread_info): Pass NULL as length parameter to ui_file_xstrdup. * arm-tdep.c (_initialize_arm_tdep): Ditto. * infrun.c (print_target_wait_results): Ditto. * language.c (add_language): Ditto. * linespec.c (cplusplus_error): Ditto. * remote.c (escape_buffer): Ditto. * typeprint.c (type_to_string): Ditto. * utils.c (error_stream): Ditto. * varobj.c (value_get_print_value): Ditto. * xtensa-tdep.c (xtensa_verify_config): Replace `dummy' local with `length' local. Pass it to ui_file_xstrdup, and avoid an strlen call. * gdbarch.sh (verify_gdbarch): Ditto. * gdbarch.c: Regenerate. * cli/cli-setshow.c (do_setshow_command): Pass NULL as length parameter to ui_file_xstrdup. * python/python-frame.c (frapy_str): Ditto. * python/python-type.c (typy_str): Use the length local instead of calling strlen. * python/python-value.c (valpy_str): Pass NULL as length parameter to ui_file_xstrdup. --- gdb/python/python-frame.c | 3 +-- gdb/python/python-type.c | 4 ++-- gdb/python/python-value.c | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c index a97009f..279415c 100644 --- a/gdb/python/python-frame.c +++ b/gdb/python/python-frame.c @@ -80,13 +80,12 @@ static PyObject * frapy_str (PyObject *self) { char *s; - long len; PyObject *result; struct ui_file *strfile; strfile = mem_fileopen (); fprint_frame_id (strfile, ((frame_object *) self)->frame_id); - s = ui_file_xstrdup (strfile, &len); + s = ui_file_xstrdup (strfile, NULL); result = PyString_FromString (s); xfree (s); diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c index e185112..f23248c 100644 --- a/gdb/python/python-type.c +++ b/gdb/python/python-type.c @@ -494,13 +494,13 @@ typy_str (PyObject *self) { volatile struct gdb_exception except; char *thetype = NULL; + long length = 0; PyObject *result; TRY_CATCH (except, RETURN_MASK_ALL) { struct cleanup *old_chain; struct ui_file *stb; - long length; stb = mem_fileopen (); old_chain = make_cleanup_ui_file_delete (stb); @@ -516,7 +516,7 @@ typy_str (PyObject *self) GDB_PY_HANDLE_EXCEPTION (except); } - result = PyUnicode_Decode (thetype, strlen (thetype), host_charset (), NULL); + result = PyUnicode_Decode (thetype, length, host_charset (), NULL); xfree (thetype); return result; diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c index c73c916..c4217d5 100644 --- a/gdb/python/python-value.c +++ b/gdb/python/python-value.c @@ -348,7 +348,6 @@ static PyObject * valpy_str (PyObject *self) { char *s = NULL; - long dummy; struct ui_file *stb; struct cleanup *old_chain; PyObject *result; @@ -365,7 +364,7 @@ valpy_str (PyObject *self) { common_val_print (((value_object *) self)->value, stb, 0, &opts, python_language); - s = ui_file_xstrdup (stb, &dummy); + s = ui_file_xstrdup (stb, NULL); } GDB_PY_HANDLE_EXCEPTION (except); -- cgit v1.1