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

@@ -1084,7 +1084,7 @@ init_static_types_names_internal (ctf_dict_t *fp, ctf_header_t *cth,
store the index of the pointer type in fp->ctf_ptrtab[ index of
referenced type ]. */
if (LCTF_TYPE_ISCHILD (fp, tp->ctt_type) == child
if (ctf_type_ischild (fp, tp->ctt_type) == child
&& LCTF_TYPE_TO_INDEX (fp, tp->ctt_type) <= fp->ctf_typemax)
fp->ctf_ptrtab[LCTF_TYPE_TO_INDEX (fp, tp->ctt_type)] = id;
/*FALLTHRU*/