type: Introduce type__delete
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
0e29fc9912
commit
6d66c9ae6b
16
dwarves.c
16
dwarves.c
|
@ -1425,13 +1425,25 @@ static size_t union__fprintf(struct type *self, const struct cu *cu,
|
||||||
conf->suffix ? " " : "", conf->suffix ?: "");
|
conf->suffix ? " " : "", conf->suffix ?: "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void class__delete(struct class *self)
|
static void type__delete_class_members(struct type *self)
|
||||||
{
|
{
|
||||||
struct class_member *pos, *next;
|
struct class_member *pos, *next;
|
||||||
|
|
||||||
type__for_each_member_safe(&self->type, pos, next)
|
type__for_each_data_member_safe(self, pos, next) {
|
||||||
|
list_del_init(&pos->tag.node);
|
||||||
class_member__delete(pos);
|
class_member__delete(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void class__delete(struct class *self)
|
||||||
|
{
|
||||||
|
type__delete_class_members(&self->type);
|
||||||
|
free(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
void type__delete(struct type *self)
|
||||||
|
{
|
||||||
|
type__delete_class_members(self);
|
||||||
free(self);
|
free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -670,6 +670,8 @@ static inline struct class *type__class(const struct type *self)
|
||||||
return (struct class *)self;
|
return (struct class *)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void type__delete(struct type *self);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* type__for_each_tag - iterate thru all the tags
|
* type__for_each_tag - iterate thru all the tags
|
||||||
* @self: struct type instance to iterate
|
* @self: struct type instance to iterate
|
||||||
|
|
Loading…
Reference in New Issue