summaryrefslogtreecommitdiff
path: root/gdb/c-typeprint.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-05-18 16:30:28 +0000
committerTom Tromey <tromey@redhat.com>2011-05-18 16:30:28 +0000
commitd0a4a5b2a9e8d88af8f90e2a617eea70000f07c6 (patch)
treefac48457adfa20e4263fb0088cb45750f360f9c0 /gdb/c-typeprint.c
parent48246fc491802387dce473f54713388d9678b94a (diff)
downloadgdb-d0a4a5b2a9e8d88af8f90e2a617eea70000f07c6.tar.gz
* 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.c24
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");
}