diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2020-06-02 21:14:22 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2020-07-22 17:57:39 +0100 |
commit | 9c23dfa5aa48c3ec94f643ce25a2b900ad0549c5 (patch) | |
tree | f6cdbe6d88b5300cf4026d5ea667fb8af9f44e2a /libctf/ctf-archive.c | |
parent | e0325e2cede6f9da2560ede6d4a17d9e21fbea9c (diff) | |
download | binutils-9c23dfa5aa48c3ec94f643ce25a2b900ad0549c5.zip binutils-9c23dfa5aa48c3ec94f643ce25a2b900ad0549c5.tar.gz binutils-9c23dfa5aa48c3ec94f643ce25a2b900ad0549c5.tar.bz2 |
libctf: add ctf_archive_count
Another count that was otherwise unavailable without doing expensive
operations.
include/
* ctf-api.h (ctf_archive_count): New.
libctf/
* ctf-archive.c (ctf_archive_count): New.
* libctf.ver: New public function.
Diffstat (limited to 'libctf/ctf-archive.c')
-rw-r--r-- | libctf/ctf-archive.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c index 3c14d7d..42e9024 100644 --- a/libctf/ctf-archive.c +++ b/libctf/ctf-archive.c @@ -617,6 +617,16 @@ ctf_arc_open_by_offset (const struct ctf_archive *arc, return fp; } +/* Return the number of members in an archive. */ +size_t +ctf_archive_count (const ctf_archive_t *wrapper) +{ + if (!wrapper->ctfi_is_archive) + return 1; + + return wrapper->ctfi_archive->ctfa_nfiles; +} + /* Raw iteration over all CTF files in an archive. We pass the raw data for all CTF files in turn to the specified callback function. */ static int |