diff --git a/dwarves.c b/dwarves.c index 97e42f1..90f5a31 100644 --- a/dwarves.c +++ b/dwarves.c @@ -417,6 +417,11 @@ static void cu__find_class_holes(struct cu *cu) class__find_holes(pos); } +bool cus__empty(const struct cus *cus) +{ + return list_empty(&cus->cus); +} + void cus__add(struct cus *cus, struct cu *cu) { cus->nr_entries++; diff --git a/dwarves.h b/dwarves.h index c177206..f0125be 100644 --- a/dwarves.h +++ b/dwarves.h @@ -142,6 +142,7 @@ struct function *cus__find_function_at_addr(const struct cus *cus, void cus__for_each_cu(struct cus *cus, int (*iterator)(struct cu *cu, void *cookie), void *cookie, struct cu *(*filter)(struct cu *cu)); +bool cus__empty(const struct cus *cus); struct ptr_table { void **entries; diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c index 08b34ba..9e76f51 100644 --- a/dwarves_fprintf.c +++ b/dwarves_fprintf.c @@ -1949,7 +1949,7 @@ size_t tag__fprintf(struct tag *tag, const struct cu *cu, void cus__print_error_msg(const char *progname, const struct cus *cus, const char *filename, const int err) { - if (err == -EINVAL || (cus != NULL && list_empty(&cus->cus))) + if (err == -EINVAL || (cus != NULL && cus__empty(cus))) fprintf(stderr, "%s: couldn't load debugging info from %s\n", progname, filename); else