* 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.
This commit is contained in:
Tom Tromey
2011-05-18 16:30:37 +00:00
parent 5652e39766
commit 1d06ead687
11 changed files with 58 additions and 29 deletions

View File

@ -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");
}