libctf: types: recursive type visiting

ctf_type_visit and ctf_type_rvisit have to adapt to the internal
API changes, but also to the change in the representation of
structures.  The new code is quite a lot simpler than the old,
because we don't need to roll our own iterator but can just use
ctf_member_next.

API changes, the usual for the *_f typedefs and anything to do with
structures:

-typedef int ctf_visit_f (const char *name, ctf_id_t type, unsigned long offset,
-			 int depth, void *arg);
+typedef int ctf_visit_f (ctf_dict_t *, const char *name, ctf_id_t type,
+			 size_t offset, int bit_width, int depth,
 			 void *arg);
This commit is contained in:
Nick Alcock
2025-04-25 11:44:19 +01:00
parent 1ece8c93c0
commit 33326f571f
2 changed files with 16 additions and 39 deletions

View File

@@ -313,8 +313,8 @@ _CTF_ERRORS
can be used with the iteration and visit functions below. There is also a
family of iteration functions that do not require callbacks. */
typedef int ctf_visit_f (const char *name, ctf_id_t type, unsigned long offset,
int depth, void *arg);
typedef int ctf_visit_f (ctf_dict_t *, const char *name, ctf_id_t type,
size_t offset, int bit_width, int depth,
void *arg);
typedef int ctf_member_f (ctf_dict_t *, const char *name, ctf_id_t membtype,
size_t offset, int bit_width, void *arg);