X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Fir%2Ffields.c;h=ec60a7b732b830ed64f863674004238957d04b58;hb=830017b03f9cded62c199b077fb2e18935f8e2ee;hp=1abf694dcc418a62fcef80862fb95bf1f133648a;hpb=abd69417bcbf0c66afc5f94c2164397f8df7915f;p=babeltrace.git diff --git a/formats/ctf/ir/fields.c b/formats/ctf/ir/fields.c index 1abf694d..ec60a7b7 100644 --- a/formats/ctf/ir/fields.c +++ b/formats/ctf/ir/fields.c @@ -167,97 +167,97 @@ int increase_packet_size(struct ctf_stream_pos *pos); static struct bt_ctf_field *(* const field_create_funcs[])( struct bt_ctf_field_type *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_create, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_create, - [BT_CTF_TYPE_ID_FLOAT] = + [CTF_TYPE_INTEGER] = bt_ctf_field_integer_create, + [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_create, + [CTF_TYPE_FLOAT] = bt_ctf_field_floating_point_create, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_create, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_create, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_create, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_create, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_create, + [CTF_TYPE_STRUCT] = bt_ctf_field_structure_create, + [CTF_TYPE_VARIANT] = bt_ctf_field_variant_create, + [CTF_TYPE_ARRAY] = bt_ctf_field_array_create, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_create, + [CTF_TYPE_STRING] = bt_ctf_field_string_create, }; static void (* const field_destroy_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_destroy, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_destroy, - [BT_CTF_TYPE_ID_FLOAT] = + [CTF_TYPE_INTEGER] = bt_ctf_field_integer_destroy, + [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_destroy, + [CTF_TYPE_FLOAT] = bt_ctf_field_floating_point_destroy, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_destroy, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_destroy, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_destroy, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_destroy, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_destroy, + [CTF_TYPE_STRUCT] = bt_ctf_field_structure_destroy, + [CTF_TYPE_VARIANT] = bt_ctf_field_variant_destroy, + [CTF_TYPE_ARRAY] = bt_ctf_field_array_destroy, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_destroy, + [CTF_TYPE_STRING] = bt_ctf_field_string_destroy, }; static int (* const field_validate_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_generic_validate, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_validate, - [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_generic_validate, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_validate, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_validate, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_validate, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_validate, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_generic_validate, + [CTF_TYPE_INTEGER] = bt_ctf_field_generic_validate, + [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_validate, + [CTF_TYPE_FLOAT] = bt_ctf_field_generic_validate, + [CTF_TYPE_STRUCT] = bt_ctf_field_structure_validate, + [CTF_TYPE_VARIANT] = bt_ctf_field_variant_validate, + [CTF_TYPE_ARRAY] = bt_ctf_field_array_validate, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_validate, + [CTF_TYPE_STRING] = bt_ctf_field_generic_validate, }; static int (* const field_reset_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_generic_reset, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_reset, - [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_generic_reset, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_reset, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_reset, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_reset, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_reset, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_reset, + [CTF_TYPE_INTEGER] = bt_ctf_field_generic_reset, + [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_reset, + [CTF_TYPE_FLOAT] = bt_ctf_field_generic_reset, + [CTF_TYPE_STRUCT] = bt_ctf_field_structure_reset, + [CTF_TYPE_VARIANT] = bt_ctf_field_variant_reset, + [CTF_TYPE_ARRAY] = bt_ctf_field_array_reset, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_reset, + [CTF_TYPE_STRING] = bt_ctf_field_string_reset, }; static int (* const field_serialize_funcs[])(struct bt_ctf_field *, struct ctf_stream_pos *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_serialize, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_serialize, - [BT_CTF_TYPE_ID_FLOAT] = + [CTF_TYPE_INTEGER] = bt_ctf_field_integer_serialize, + [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_serialize, + [CTF_TYPE_FLOAT] = bt_ctf_field_floating_point_serialize, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_serialize, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_serialize, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_serialize, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_serialize, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_serialize, + [CTF_TYPE_STRUCT] = bt_ctf_field_structure_serialize, + [CTF_TYPE_VARIANT] = bt_ctf_field_variant_serialize, + [CTF_TYPE_ARRAY] = bt_ctf_field_array_serialize, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_serialize, + [CTF_TYPE_STRING] = bt_ctf_field_string_serialize, }; static int (* const field_copy_funcs[])(struct bt_ctf_field *, struct bt_ctf_field *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_copy, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_copy, - [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_floating_point_copy, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_copy, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_copy, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_copy, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_copy, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_copy, + [CTF_TYPE_INTEGER] = bt_ctf_field_integer_copy, + [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_copy, + [CTF_TYPE_FLOAT] = bt_ctf_field_floating_point_copy, + [CTF_TYPE_STRUCT] = bt_ctf_field_structure_copy, + [CTF_TYPE_VARIANT] = bt_ctf_field_variant_copy, + [CTF_TYPE_ARRAY] = bt_ctf_field_array_copy, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_copy, + [CTF_TYPE_STRING] = bt_ctf_field_string_copy, }; static void (* const field_freeze_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_TYPE_ID_INTEGER] = generic_field_freeze, - [BT_CTF_TYPE_ID_FLOAT] = generic_field_freeze, - [BT_CTF_TYPE_ID_STRING] = generic_field_freeze, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_freeze, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_freeze, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_freeze, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_freeze, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_freeze, + [CTF_TYPE_INTEGER] = generic_field_freeze, + [CTF_TYPE_FLOAT] = generic_field_freeze, + [CTF_TYPE_STRING] = generic_field_freeze, + [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_freeze, + [CTF_TYPE_STRUCT] = bt_ctf_field_structure_freeze, + [CTF_TYPE_VARIANT] = bt_ctf_field_variant_freeze, + [CTF_TYPE_ARRAY] = bt_ctf_field_array_freeze, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_freeze, }; struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type) { struct bt_ctf_field *field = NULL; - enum bt_ctf_type_id type_id; + enum ctf_type_id type_id; int ret; if (!type) { @@ -265,8 +265,8 @@ struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type) } type_id = bt_ctf_field_type_get_type_id(type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || - type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= CTF_TYPE_UNKNOWN || + type_id >= NR_CTF_TYPES) { goto error; } @@ -318,9 +318,9 @@ end: } BT_HIDDEN -enum bt_ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field) +enum ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field) { - enum bt_ctf_type_id ret = BT_CTF_TYPE_ID_UNKNOWN; + enum ctf_type_id ret = CTF_TYPE_UNKNOWN; if (!field) { goto end; @@ -334,49 +334,49 @@ end: BT_HIDDEN int bt_ctf_field_is_integer(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_INTEGER; + return bt_ctf_field_get_type_id(field) == CTF_TYPE_INTEGER; } BT_HIDDEN int bt_ctf_field_is_floating_point(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_FLOAT; + return bt_ctf_field_get_type_id(field) == CTF_TYPE_FLOAT; } BT_HIDDEN int bt_ctf_field_is_enumeration(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_ENUM; + return bt_ctf_field_get_type_id(field) == CTF_TYPE_ENUM; } BT_HIDDEN int bt_ctf_field_is_string(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_STRING; + return bt_ctf_field_get_type_id(field) == CTF_TYPE_STRING; } BT_HIDDEN int bt_ctf_field_is_structure(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_STRUCT; + return bt_ctf_field_get_type_id(field) == CTF_TYPE_STRUCT; } BT_HIDDEN int bt_ctf_field_is_array(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_ARRAY; + return bt_ctf_field_get_type_id(field) == CTF_TYPE_ARRAY; } BT_HIDDEN int bt_ctf_field_is_sequence(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_SEQUENCE; + return bt_ctf_field_get_type_id(field) == CTF_TYPE_SEQUENCE; } BT_HIDDEN int bt_ctf_field_is_variant(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_VARIANT; + return bt_ctf_field_get_type_id(field) == CTF_TYPE_VARIANT; } BT_HIDDEN @@ -391,7 +391,7 @@ struct bt_ctf_field *bt_ctf_field_sequence_get_length( } if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_SEQUENCE) { + CTF_TYPE_SEQUENCE) { goto end; } @@ -416,7 +416,7 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field, goto end; } if (bt_ctf_field_type_get_type_id(length_field->type) != - BT_CTF_TYPE_ID_INTEGER) { + CTF_TYPE_INTEGER) { ret = -1; goto end; } @@ -464,7 +464,7 @@ struct bt_ctf_field *bt_ctf_field_structure_get_field( if (!field || !name || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { goto error; } @@ -516,7 +516,7 @@ struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index( if (!field || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { goto end; } @@ -573,7 +573,7 @@ int bt_ctf_field_structure_set_field(struct bt_ctf_field *field, if (!field || !name || !value || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { ret = -1; goto end; } @@ -615,7 +615,7 @@ struct bt_ctf_field *bt_ctf_field_array_get_field(struct bt_ctf_field *field, struct bt_ctf_field_array *array; if (!field || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_ARRAY) { + CTF_TYPE_ARRAY) { goto end; } @@ -655,7 +655,7 @@ struct bt_ctf_field *bt_ctf_field_sequence_get_field(struct bt_ctf_field *field, struct bt_ctf_field_sequence *sequence; if (!field || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_SEQUENCE) { + CTF_TYPE_SEQUENCE) { goto end; } @@ -700,9 +700,9 @@ struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field, if (!field || !tag_field || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_VARIANT || + CTF_TYPE_VARIANT || bt_ctf_field_type_get_type_id(tag_field->type) != - BT_CTF_TYPE_ID_ENUM) { + CTF_TYPE_ENUM) { goto end; } @@ -784,7 +784,7 @@ struct bt_ctf_field *bt_ctf_field_variant_get_current_field( if (!variant_field || bt_ctf_field_type_get_type_id(variant_field->type) != - BT_CTF_TYPE_ID_VARIANT) { + CTF_TYPE_VARIANT) { goto end; } @@ -808,7 +808,7 @@ struct bt_ctf_field *bt_ctf_field_enumeration_get_container( struct bt_ctf_field_enumeration *enumeration; if (!field || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_ENUM) { + CTF_TYPE_ENUM) { goto end; } @@ -899,7 +899,7 @@ int bt_ctf_field_signed_integer_get_value(struct bt_ctf_field *field, if (!field || !value || !field->payload_set || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_INTEGER) { + CTF_TYPE_INTEGER) { ret = -1; goto end; } @@ -929,7 +929,7 @@ int bt_ctf_field_signed_integer_set_value(struct bt_ctf_field *field, if (!field || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_INTEGER) { + CTF_TYPE_INTEGER) { ret = -1; goto end; } @@ -966,7 +966,7 @@ int bt_ctf_field_unsigned_integer_get_value(struct bt_ctf_field *field, if (!field || !value || !field->payload_set || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_INTEGER) { + CTF_TYPE_INTEGER) { ret = -1; goto end; } @@ -996,7 +996,7 @@ int bt_ctf_field_unsigned_integer_set_value(struct bt_ctf_field *field, if (!field || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_INTEGER) { + CTF_TYPE_INTEGER) { ret = -1; goto end; } @@ -1031,7 +1031,7 @@ int bt_ctf_field_floating_point_get_value(struct bt_ctf_field *field, if (!field || !value || !field->payload_set || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_FLOAT) { + CTF_TYPE_FLOAT) { ret = -1; goto end; } @@ -1051,7 +1051,7 @@ int bt_ctf_field_floating_point_set_value(struct bt_ctf_field *field, if (!field || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_FLOAT) { + CTF_TYPE_FLOAT) { ret = -1; goto end; } @@ -1071,7 +1071,7 @@ const char *bt_ctf_field_string_get_value(struct bt_ctf_field *field) if (!field || !field->payload_set || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRING) { + CTF_TYPE_STRING) { goto end; } @@ -1090,7 +1090,7 @@ int bt_ctf_field_string_set_value(struct bt_ctf_field *field, if (!field || !value || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRING) { + CTF_TYPE_STRING) { ret = -1; goto end; } @@ -1116,7 +1116,7 @@ int bt_ctf_field_string_append(struct bt_ctf_field *field, if (!field || !value || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRING) { + CTF_TYPE_STRING) { ret = -1; goto end; } @@ -1146,7 +1146,7 @@ int bt_ctf_field_string_append_len(struct bt_ctf_field *field, if (!field || !value || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRING) { + CTF_TYPE_STRING) { ret = -1; goto end; } @@ -1179,7 +1179,7 @@ BT_HIDDEN int bt_ctf_field_validate(struct bt_ctf_field *field) { int ret = 0; - enum bt_ctf_type_id type_id; + enum ctf_type_id type_id; if (!field) { ret = -1; @@ -1187,7 +1187,7 @@ int bt_ctf_field_validate(struct bt_ctf_field *field) } type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) { ret = -1; goto end; } @@ -1201,7 +1201,7 @@ BT_HIDDEN int bt_ctf_field_reset(struct bt_ctf_field *field) { int ret = 0; - enum bt_ctf_type_id type_id; + enum ctf_type_id type_id; if (!field) { ret = -1; @@ -1209,7 +1209,7 @@ int bt_ctf_field_reset(struct bt_ctf_field *field) } type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) { ret = -1; goto end; } @@ -1224,7 +1224,7 @@ int bt_ctf_field_serialize(struct bt_ctf_field *field, struct ctf_stream_pos *pos) { int ret = 0; - enum bt_ctf_type_id type_id; + enum ctf_type_id type_id; if (!field || !pos) { ret = -1; @@ -1232,7 +1232,7 @@ int bt_ctf_field_serialize(struct bt_ctf_field *field, } type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) { ret = -1; goto end; } @@ -1247,14 +1247,14 @@ struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field) { int ret; struct bt_ctf_field *copy = NULL; - enum bt_ctf_type_id type_id; + enum ctf_type_id type_id; if (!field) { goto end; } type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) { goto end; } @@ -1416,13 +1416,13 @@ void bt_ctf_field_destroy(struct bt_object *obj) { struct bt_ctf_field *field; struct bt_ctf_field_type *type; - enum bt_ctf_type_id type_id; + enum ctf_type_id type_id; field = container_of(obj, struct bt_ctf_field, base); type = field->type; type_id = bt_ctf_field_type_get_type_id(type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || - type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= CTF_TYPE_UNKNOWN || + type_id >= NR_CTF_TYPES) { return; } @@ -2360,15 +2360,15 @@ void bt_ctf_field_sequence_freeze(struct bt_ctf_field *field) BT_HIDDEN void bt_ctf_field_freeze(struct bt_ctf_field *field) { - enum bt_ctf_type_id type_id; + enum ctf_type_id type_id; if (!field) { goto end; } type_id = bt_ctf_field_get_type_id(field); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || - type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= CTF_TYPE_UNKNOWN || + type_id >= NR_CTF_TYPES) { goto end; }