diff --git a/classes.c b/classes.c index ed18383..fe934c1 100644 --- a/classes.c +++ b/classes.c @@ -52,7 +52,7 @@ struct class *classes__find_by_name(const char *name) return NULL; } -static struct class *classes__find_by_id(const struct cu_info *type) +struct class *classes__find_by_id(const struct cu_info *type) { struct class *pos; @@ -387,6 +387,16 @@ static void classes__add(struct class *class) list_add_tail(&class->node, &classes__list); } +void classes__for_each(int (*iterator)(struct class *class, void *cookie), + void *cookie) +{ + struct class *pos; + + list_for_each_entry(pos, &classes__list, node) + if (iterator(pos, cookie)) + break; +} + void classes__print(const unsigned int tag) { struct class *pos; diff --git a/classes.h b/classes.h index 8cc5de7..91ac916 100644 --- a/classes.h +++ b/classes.h @@ -51,6 +51,10 @@ extern void class__print(struct class *self); extern int classes__load(const char *filename); extern struct class *classes__find_by_name(const char *name); +extern struct class *classes__find_by_id(const struct cu_info *type); extern void classes__print(const unsigned int tag); +extern void classes__for_each(int (*iterator)(struct class *class, + void *cookie), + void *cookie); #endif /* _PAHOLE_CLASSES_H_ */