libctf: reimplement many _iter iterators in terms of _next
authorNick Alcock <nick.alcock@oracle.com>
Thu, 18 Feb 2021 17:03:28 +0000 (17:03 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 2 Mar 2021 15:09:18 +0000 (15:09 +0000)
commitac36e134d96fa71a2f5c141058e06b57bcc72136
treee6647d27d24de83a812c7960384abec8a9dcec41
parenteaa2913a7acead8654e7e79ba13c0d22fd70a452
libctf: reimplement many _iter iterators in terms of _next

Ever since the generator-style _next iterators were introduced, there
have been separate implementations of the functional-style _iter
iterators that do the same thing as _next.

This is annoying and adds more dependencies on the internal guts of the
file format.  Rip them all out and replace them with the corresponding
_next iterators.  Only ctf_archive_raw_iter and ctf_label_iter survive,
the former because there is no access to the raw binary data of archives
via any _next iterator, and the latter because ctf_label_next hasn't
been implemented (because labels are currently not used for anything).

Tested by reverting the change (already applied) that reimplemented
ctf_member_iter in terms of ctf_member_next, then verifying that the
_iter and _next iterators produced the same results for every iterable
entity within a large type archive.

libctf/ChangeLog
2021-03-02  Nick Alcock  <nick.alcock@oracle.com>

* ctf-types.c (ctf_member_iter): Move 'rc' to an inner scope.
(ctf_enum_iter): Reimplement in terms of ctf_enum_next.
(ctf_type_iter): Reimplement in terms of ctf_type_next.
(ctf_type_iter_all): Likewise.
(ctf_variable_iter): Reimplement in terms of ctf_variable_next.
* ctf-archive.c (ctf_archive_iter_internal): Remove.
(ctf_archive_iter): Reimplement in terms of ctf_archive_next.
libctf/ChangeLog
libctf/ctf-archive.c
libctf/ctf-types.c
This page took 0.027511 seconds and 4 git commands to generate.