enumerator: Introduce enumerator__delete

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

View File

@ -1447,6 +1447,20 @@ void type__delete(struct type *self)
free(self);
}
static void enumerator__delete(struct enumerator *self)
{
free(self);
}
void enumeration__delete(struct type *self)
{
struct enumerator *pos, *n;
type__for_each_enumerator_safe(self, pos, n) {
list_del_init(&pos->tag.node);
enumerator__delete(pos);
}
}
void class__add_vtable_entry(struct class *self, struct function *vtable_entry)
{
++self->nr_vtable_entries;

View File

@ -692,6 +692,16 @@ void type__delete(struct type *self);
&(self)->namespace.tags; \
list_for_each_entry(pos, __type__for_each_enumerator_head, tag.node)
/**
* type__for_each_enumerator_safe - safely iterate thru the enumerator entries
* @self: struct type instance to iterate
* @pos: struct enumerator iterator
* @n: struct enumerator temp iterator
*/
#define type__for_each_enumerator_safe(self, pos, n) \
if ((self)->namespace.shared_tags) /* Do nothing */ ; else \
list_for_each_entry_safe(pos, n, &(self)->namespace.tags, tag.node)
/**
* type__for_each_member - iterate thru the entries that use space
* (data members and inheritance entries)
@ -878,6 +888,7 @@ struct enumerator {
uint32_t value;
};
void enumeration__delete(struct type *self);
void enumeration__add(struct type *self, struct enumerator *enumerator);
size_t enumeration__fprintf(const struct tag *tag_self,
const struct conf_fprintf *conf, FILE *fp);