2007-08-17 Michael Snyder <msnyder@access-company.com>

* gdbtypes.h (virtual_base_list): Remove export decl.
	* gdbtypes.c (virtual_base_list): Make static.  Not called outside.
	(virtual_base_index): Memory leak.
	(virtual_base_index_skip_primaries): Ditto.
This commit is contained in:
Michael Snyder
2007-08-17 23:12:47 +00:00
parent 7e976ae46d
commit 0bd9908d01
3 changed files with 22 additions and 22 deletions

View File

@ -1,3 +1,10 @@
2007-08-17 Michael Snyder <msnyder@access-company.com>
* gdbtypes.h (virtual_base_list): Remove export decl.
* gdbtypes.c (virtual_base_list): Make static. Not called outside.
(virtual_base_index): Memory leak.
(virtual_base_index_skip_primaries): Ditto.
2007-08-17 Maxim Grigoriev <maxim2405@gmail.com> 2007-08-17 Maxim Grigoriev <maxim2405@gmail.com>
* xtensa-tdep.c (ARG_NOF, ARG_1ST, PS_WOE, PS_EXC, C0_MAXOPDS) * xtensa-tdep.c (ARG_NOF, ARG_1ST, PS_WOE, PS_EXC, C0_MAXOPDS)

View File

@ -2024,7 +2024,7 @@ virtual_base_list_aux (struct type *dclass)
This routine merely hands off the argument to virtual_base_list_aux() This routine merely hands off the argument to virtual_base_list_aux()
and then copies the result into an array to save space. */ and then copies the result into an array to save space. */
struct type ** static struct type **
virtual_base_list (struct type *dclass) virtual_base_list (struct type *dclass)
{ {
struct vbase *tmp_vbase; struct vbase *tmp_vbase;
@ -2112,7 +2112,6 @@ virtual_base_list_length_skip_primaries (struct type *dclass)
return i; return i;
} }
/* Return the index (position) of type BASE, which is a virtual base /* Return the index (position) of type BASE, which is a virtual base
class of DCLASS, in the latter's virtual base list. A return of -1 class of DCLASS, in the latter's virtual base list. A return of -1
indicates "not found" or a problem. */ indicates "not found" or a problem. */
@ -2120,27 +2119,24 @@ virtual_base_list_length_skip_primaries (struct type *dclass)
int int
virtual_base_index (struct type *base, struct type *dclass) virtual_base_index (struct type *base, struct type *dclass)
{ {
struct type *vbase; struct type *vbase, **vbase_list;
int i; int i;
if ((TYPE_CODE (dclass) != TYPE_CODE_CLASS) if ((TYPE_CODE (dclass) != TYPE_CODE_CLASS)
|| (TYPE_CODE (base) != TYPE_CODE_CLASS)) || (TYPE_CODE (base) != TYPE_CODE_CLASS))
return -1; return -1;
i = 0; vbase_list = virtual_base_list (dclass);
vbase = virtual_base_list (dclass)[0]; for (i = 0, vbase = vbase_list[0];
while (vbase) vbase != NULL;
{ vbase = vbase_list[++i])
if (vbase == base) if (vbase == base)
break; break;
vbase = virtual_base_list (dclass)[++i];
}
xfree (vbase_list);
return vbase ? i : -1; return vbase ? i : -1;
} }
/* Return the index (position) of type BASE, which is a virtual base /* Return the index (position) of type BASE, which is a virtual base
class of DCLASS, in the latter's virtual base list. Skip over all class of DCLASS, in the latter's virtual base list. Skip over all
bases that may appear in the virtual base list of the primary base bases that may appear in the virtual base list of the primary base
@ -2151,7 +2147,7 @@ int
virtual_base_index_skip_primaries (struct type *base, virtual_base_index_skip_primaries (struct type *base,
struct type *dclass) struct type *dclass)
{ {
struct type *vbase; struct type *vbase, **vbase_list;
int i, j; int i, j;
struct type *primary; struct type *primary;
@ -2161,19 +2157,18 @@ virtual_base_index_skip_primaries (struct type *base,
primary = TYPE_RUNTIME_PTR (dclass) ? TYPE_PRIMARY_BASE (dclass) : NULL; primary = TYPE_RUNTIME_PTR (dclass) ? TYPE_PRIMARY_BASE (dclass) : NULL;
j = -1; vbase_list = virtual_base_list (dclass);
i = 0; for (i = 0, j = -1, vbase = vbase_list[0];
vbase = virtual_base_list (dclass)[0]; vbase != NULL;
while (vbase) vbase = vbase_list[++i])
{ {
if (!primary if (!primary
|| (virtual_base_index_skip_primaries (vbase, primary) < 0)) || (virtual_base_index_skip_primaries (vbase, primary) < 0))
j++; j++;
if (vbase == base) if (vbase == base)
break; break;
vbase = virtual_base_list (dclass)[++i];
} }
xfree (vbase_list);
return vbase ? j : -1; return vbase ? j : -1;
} }

View File

@ -1346,8 +1346,6 @@ extern int has_vtable (struct type *);
extern struct type *primary_base_class (struct type *); extern struct type *primary_base_class (struct type *);
extern struct type **virtual_base_list (struct type *);
extern int virtual_base_list_length (struct type *); extern int virtual_base_list_length (struct type *);
extern int virtual_base_list_length_skip_primaries (struct type *); extern int virtual_base_list_length_skip_primaries (struct type *);