core: Introduce helper to return if there is no cu entries in a 'struct cus'

Provide a helper so that we can make 'struct cus' opaque.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2021-06-22 10:42:55 -03:00
parent 7020f92143
commit bf74fc1fcf
3 changed files with 7 additions and 1 deletions

View File

@ -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++;

View File

@ -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;

View File

@ -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