diff options
-rw-r--r-- | include/ChangeLog | 4 | ||||
-rw-r--r-- | include/ctf-api.h | 1 | ||||
-rw-r--r-- | libctf/ChangeLog | 5 | ||||
-rw-r--r-- | libctf/ctf-archive.c | 10 | ||||
-rw-r--r-- | libctf/libctf.ver | 1 |
5 files changed, 21 insertions, 0 deletions
diff --git a/include/ChangeLog b/include/ChangeLog index 27ffb90..dd9d5e0 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,5 +1,9 @@ 2020-07-22 Nick Alcock <nick.alcock@oracle.com> + * ctf-api.h (ctf_archive_count): New. + +2020-07-22 Nick Alcock <nick.alcock@oracle.com> + * ctf-api.h (ctf_member_count): New. 2020-07-22 Nick Alcock <nick.alcock@oracle.com> diff --git a/include/ctf-api.h b/include/ctf-api.h index 7cdf4a5..fb797a3 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -276,6 +276,7 @@ extern ctf_file_t *ctf_arc_open_by_name_sections (const ctf_archive_t *, const ctf_sect_t *, const ctf_sect_t *, const char *, int *); +extern size_t ctf_archive_count (const ctf_archive_t *); /* The next functions return or close real CTF files, or write out CTF archives, not opaque containers around either. */ diff --git a/libctf/ChangeLog b/libctf/ChangeLog index 7df7867..0be8280 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,5 +1,10 @@ 2020-07-22 Nick Alcock <nick.alcock@oracle.com> + * ctf-archive.c (ctf_archive_count): New. + * libctf.ver: New public function. + +2020-07-22 Nick Alcock <nick.alcock@oracle.com> + * ctf-types.c (ctf_member_count): New. * libctf.ver: New public function. 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 diff --git a/libctf/libctf.ver b/libctf/libctf.ver index 77b380c..375dee8 100644 --- a/libctf/libctf.ver +++ b/libctf/libctf.ver @@ -135,6 +135,7 @@ LIBCTF_1.0 { ctf_arc_close; ctf_arc_open_by_name; ctf_arc_open_by_name_sections; + ctf_archive_count; ctf_archive_iter; ctf_archive_raw_iter; ctf_get_arc; |