reorganize: Introduce class__for_each_member_from_safe()

Reducing boilerplate, keeping consistent with the other member traversal
helpers.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2019-04-05 16:16:16 -03:00
parent 1b2e3389f3
commit 881aabd6fc
2 changed files with 9 additions and 8 deletions

View File

@ -1127,6 +1127,13 @@ const struct class_member *class__find_bit_hole(const struct class *cls,
continue; \
else
#define class__for_each_member_safe_from(cls, from, pos, tmp) \
pos = list_prepare_entry(from, class__tags(cls), tag.node); \
list_for_each_entry_safe_from(pos, tmp, class__tags(cls), tag.node) \
if (!tag__is_class_member(&pos->tag)) \
continue; \
else
#define class__for_each_member_continue(cls, from, pos) \
pos = list_prepare_entry(from, class__tags(cls), tag.node); \
list_for_each_entry_continue(pos, class__tags(cls), tag.node) \

View File

@ -253,19 +253,13 @@ static bool class__move_member(struct class *class, struct class_member *dest,
fputs("/* Moving", fp);
if (from->bitfield_size != 0) {
struct class_member *pos =
list_prepare_entry(from, class__tags(class),
tag.node);
struct class_member *tmp;
struct class_member *pos, *tmp;
LIST_HEAD(from_list);
if (verbose)
fprintf(fp, " bitfield('%s' ... ",
class_member__name(from, cu));
list_for_each_entry_safe_from(pos, tmp, class__tags(class),
tag.node) {
if (pos->tag.tag != DW_TAG_member)
continue;
class__for_each_member_safe_from(class, from, pos, tmp) {
/*
* Have we reached the end of the bitfield?
*/