type: Introduce type__delete

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2009-03-25 12:00:30 -03:00
parent 0e29fc9912
commit 6d66c9ae6b
2 changed files with 16 additions and 2 deletions

View File

@ -1425,13 +1425,25 @@ static size_t union__fprintf(struct type *self, const struct cu *cu,
conf->suffix ? " " : "", conf->suffix ?: "");
}
void class__delete(struct class *self)
static void type__delete_class_members(struct type *self)
{
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);
}
}
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);
}

View File

@ -670,6 +670,8 @@ static inline struct class *type__class(const struct type *self)
return (struct class *)self;
}
void type__delete(struct type *self);
/**
* type__for_each_tag - iterate thru all the tags
* @self: struct type instance to iterate