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.
This commit is contained in:
parent
e0325e2ced
commit
9c23dfa5aa
5 changed files with 21 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
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>
|
2020-07-22 Nick Alcock <nick.alcock@oracle.com>
|
||||||
|
|
||||||
* ctf-api.h (ctf_member_count): New.
|
* ctf-api.h (ctf_member_count): New.
|
||||||
|
|
|
@ -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 ctf_sect_t *,
|
const ctf_sect_t *,
|
||||||
const char *, int *);
|
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,
|
/* The next functions return or close real CTF files, or write out CTF archives,
|
||||||
not opaque containers around either. */
|
not opaque containers around either. */
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
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>
|
2020-07-22 Nick Alcock <nick.alcock@oracle.com>
|
||||||
|
|
||||||
* ctf-types.c (ctf_member_count): New.
|
* ctf-types.c (ctf_member_count): New.
|
||||||
|
|
|
@ -617,6 +617,16 @@ ctf_arc_open_by_offset (const struct ctf_archive *arc,
|
||||||
return fp;
|
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
|
/* 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. */
|
CTF files in turn to the specified callback function. */
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -135,6 +135,7 @@ LIBCTF_1.0 {
|
||||||
ctf_arc_close;
|
ctf_arc_close;
|
||||||
ctf_arc_open_by_name;
|
ctf_arc_open_by_name;
|
||||||
ctf_arc_open_by_name_sections;
|
ctf_arc_open_by_name_sections;
|
||||||
|
ctf_archive_count;
|
||||||
ctf_archive_iter;
|
ctf_archive_iter;
|
||||||
ctf_archive_raw_iter;
|
ctf_archive_raw_iter;
|
||||||
ctf_get_arc;
|
ctf_get_arc;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue