libctf: drop LCTF_TYPE_ISPARENT/LCTF_TYPE_ISCHILD

Parent/child determination is about to become rather more complex, making a
macro impractical.  Use the ctf_type_isparent/ischild function calls
everywhere and remove the macro.  Make them more const-correct too, to
make them more widely usable.

While we're about it, change several places that hand-implemented
ctf_get_dict() to call it instead, and armour several functions against
the null returns that were always possible in this case (but previously
unprotected-against).
This commit is contained in:
Nick Alcock
2025-01-29 12:30:58 +00:00
parent 9835747b21
commit b875301e74
7 changed files with 51 additions and 46 deletions

View File

@@ -473,8 +473,8 @@ extern void ctf_dict_close (ctf_dict_t *);
extern const char *ctf_cuname (ctf_dict_t *);
extern ctf_dict_t *ctf_parent_dict (ctf_dict_t *);
extern const char *ctf_parent_name (ctf_dict_t *);
extern int ctf_type_isparent (ctf_dict_t *, ctf_id_t);
extern int ctf_type_ischild (ctf_dict_t *, ctf_id_t);
extern int ctf_type_isparent (const ctf_dict_t *, ctf_id_t);
extern int ctf_type_ischild (const ctf_dict_t *, ctf_id_t);
extern int ctf_import (ctf_dict_t *, ctf_dict_t *);
/* Set these names (used when creating dicts). */