From 064bf4578547c6da4b83e7910f1c037dff0c19fb Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Mon, 10 Nov 2025 15:59:53 +0000 Subject: [PATCH] libctf, API review: delete ctf_type_ischild() This is just !ctf_type_isparent(). --- include/ctf-api.h | 4 +++- libctf/ctf-inlines.h | 6 ++++++ libctf/ctf-types.c | 6 ------ libctf/libctf.ver | 1 - 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/ctf-api.h b/include/ctf-api.h index f037e217f43..d4dd853b11b 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -536,6 +536,9 @@ extern void ctf_dict_close (ctf_dict_t *); up already, but if opening via raw low-level calls, you need to figure out which dict is the parent and set it on the child via ctf_import(). + To determine whether a CTF type is in a child, use !ctf_type_isparent(). + (ctf_type_isparent cannot fail.) + Almost all operations other than ctf_import and ctf_close do not work on child dicts that have not yet had ctf_import called on them; in particular, name lookups and type lookup in general are broken, as is type addition. */ @@ -544,7 +547,6 @@ 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 ctf_bool_t ctf_type_isparent (const ctf_dict_t *, ctf_id_t); -extern ctf_bool_t ctf_type_ischild (const ctf_dict_t *, ctf_id_t); extern ctf_ret_t ctf_import (ctf_dict_t *child, ctf_dict_t *parent); /* Set these names (used when creating dicts). */ diff --git a/libctf/ctf-inlines.h b/libctf/ctf-inlines.h index f6ba6967c4a..081363eaf83 100644 --- a/libctf/ctf-inlines.h +++ b/libctf/ctf-inlines.h @@ -90,6 +90,12 @@ ctf_assert_internal (ctf_dict_t *fp, const char *file, size_t line, return expr; } +static inline ctf_bool_t +ctf_type_ischild (const ctf_dict_t *fp, ctf_id_t id) +{ + return (!ctf_type_isparent (fp, id)); +} + /* Un-inline these functions if debugging, so you can drop breakpoints on the setting of any error anywhere by the library. */ diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c index 6cf0aa71e38..8c9303551e3 100644 --- a/libctf/ctf-types.c +++ b/libctf/ctf-types.c @@ -59,12 +59,6 @@ ctf_type_isparent (const ctf_dict_t *fp, ctf_id_t id) return 0; } -ctf_bool_t -ctf_type_ischild (const ctf_dict_t *fp, ctf_id_t id) -{ - return (!ctf_type_isparent (fp, id)); -} - /* Get the index in the internal type array (or otherwise) for a given type ID. Only ever called on the right dictionary for the type, and can fail otherwise. If called on an invalid type, may return an index that does not correspond to diff --git a/libctf/libctf.ver b/libctf/libctf.ver index 70e4d3a05d5..1df2e1405b5 100644 --- a/libctf/libctf.ver +++ b/libctf/libctf.ver @@ -35,7 +35,6 @@ LIBCTF_2.0 { ctf_parent_name_set; ctf_parent_dict; ctf_type_isparent; - ctf_type_ischild; ctf_import; ctf_setmodel; -- 2.47.3