diff options
author | 2011-05-18 16:30:37 +0000 | |
---|---|---|
committer | 2011-05-18 16:30:37 +0000 | |
commit | 1d06ead6876712e45010dae36b8e4745fa3321ea (patch) | |
tree | f62b4d275fdbd3b21ba54d5e7185bcf47e644cd4 /gdb/c-typeprint.c | |
parent | * gas/arm/req.l: Updated expected warning message. (diff) | |
download | binutils-gdb-1d06ead6876712e45010dae36b8e4745fa3321ea.tar.gz binutils-gdb-1d06ead6876712e45010dae36b8e4745fa3321ea.tar.bz2 binutils-gdb-1d06ead6876712e45010dae36b8e4745fa3321ea.zip |
* value.c (value_fn_field): Constify.
* symtab.c (gdb_mangle_name): Constify.
* stabsread.c (update_method_name_from_physname): Make 'physname'
argument const.
* p-typeprint.c (pascal_type_print_method_args): Make arguments
const. Use explicit fputc_filtered loop.
(pascal_type_print_base): Constify.
* p-lang.h (pascal_type_print_method_args): Update.
* linespec.c (add_matching_methods): Constify.
(add_constructors): Likewise.
* jv-typeprint.c (java_type_print_base): Constify.
* gdbtypes.h (struct cplus_struct_type)
<fn_fieldlist.fn_field.physname>: Now const.
* dwarf2read.c (compute_delayed_physnames): Constify.
(dwarf2_add_member_fn): Likewise.
* c-typeprint.c (c_type_print_base): Constify. Use cleanups.
Diffstat (limited to 'gdb/c-typeprint.c')
-rw-r--r-- | gdb/c-typeprint.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 2e23dd7f9f1..021223217eb 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -719,9 +719,6 @@ c_type_print_base (struct type *type, struct ui_file *stream, int i; int len, real_len; int lastval; - char *mangled_name; - char *demangled_name; - char *demangled_no_static; enum { s_none, s_public, s_private, s_protected @@ -1001,7 +998,10 @@ c_type_print_base (struct type *type, struct ui_file *stream, for (j = 0; j < len2; j++) { - char *physname = TYPE_FN_FIELD_PHYSNAME (f, j); + const char *mangled_name; + char *demangled_name; + struct cleanup *inner_cleanup; + const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j); int is_full_physname_constructor = is_constructor_name (physname) || is_destructor_name (physname) @@ -1011,6 +1011,8 @@ c_type_print_base (struct type *type, struct ui_file *stream, if (TYPE_FN_FIELD_ARTIFICIAL (f, j)) continue; + inner_cleanup = make_cleanup (null_cleanup, NULL); + QUIT; if (TYPE_FN_FIELD_PROTECTED (f, j)) { @@ -1064,8 +1066,14 @@ c_type_print_base (struct type *type, struct ui_file *stream, fputs_filtered (" ", stream); } if (TYPE_FN_FIELD_STUB (f, j)) - /* Build something we can demangle. */ - mangled_name = gdb_mangle_name (type, i, j); + { + char *tem; + + /* Build something we can demangle. */ + tem = gdb_mangle_name (type, i, j); + make_cleanup (xfree, tem); + mangled_name = tem; + } else mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j); @@ -1107,6 +1115,7 @@ c_type_print_base (struct type *type, struct ui_file *stream, if (p != NULL) { int length = p - demangled_no_class; + char *demangled_no_static; demangled_no_static = (char *) xmalloc (length + 1); @@ -1121,8 +1130,7 @@ c_type_print_base (struct type *type, struct ui_file *stream, xfree (demangled_name); } - if (TYPE_FN_FIELD_STUB (f, j)) - xfree (mangled_name); + do_cleanups (inner_cleanup); fprintf_filtered (stream, ";\n"); } |