summaryrefslogtreecommitdiff
path: root/gdb/ui-file.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2009-08-14 00:32:31 +0000
committerPedro Alves <pedro@codesourcery.com>2009-08-14 00:32:31 +0000
commit013c637ee0cd488e79d73206a0347df969d2f33a (patch)
tree8fe9b82de8f860e2fc8e32522e8f15c1b13f1a8a /gdb/ui-file.c
parenta9e8bba767b606fbc72af7fc3dddf01342b70143 (diff)
downloadgdb-013c637ee0cd488e79d73206a0347df969d2f33a.tar.gz
* 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.
Diffstat (limited to 'gdb/ui-file.c')
-rw-r--r--gdb/ui-file.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/ui-file.c b/gdb/ui-file.c
index 02a031410ca..527917c414f 100644
--- a/gdb/ui-file.c
+++ b/gdb/ui-file.c
@@ -285,8 +285,7 @@ do_ui_file_xstrdup (void *context, const char *buffer, long length)
}
char *
-ui_file_xstrdup (struct ui_file *file,
- long *length)
+ui_file_xstrdup (struct ui_file *file, long *length)
{
struct accumulated_ui_file acc;
acc.buffer = NULL;
@@ -294,7 +293,8 @@ ui_file_xstrdup (struct ui_file *file,
ui_file_put (file, do_ui_file_xstrdup, &acc);
if (acc.buffer == NULL)
acc.buffer = xstrdup ("");
- *length = acc.length;
+ if (length != NULL)
+ *length = acc.length;
return acc.buffer;
}