From 830017b03f9cded62c199b077fb2e18935f8e2ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sun, 23 Oct 2016 21:54:39 -0400 Subject: [PATCH] Fix enum rename warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/event-class.c | 12 +- formats/ctf/ir/event.c | 4 +- formats/ctf/ir/field-types.c | 285 +++++++++--------- formats/ctf/ir/fields.c | 208 ++++++------- formats/ctf/ir/packet.c | 1 + formats/ctf/ir/resolve.c | 4 +- formats/ctf/ir/stream-class.c | 6 +- formats/ctf/ir/stream.c | 12 +- formats/ctf/ir/trace.c | 2 +- formats/ctf/ir/validation.c | 10 +- .../babeltrace/ctf-ir/field-path-internal.h | 2 +- .../babeltrace/ctf-ir/field-types-internal.h | 16 +- include/babeltrace/ctf-ir/fields-internal.h | 2 +- 13 files changed, 276 insertions(+), 288 deletions(-) diff --git a/formats/ctf/ir/event-class.c b/formats/ctf/ir/event-class.c index 00ada363..b86d0b3d 100644 --- a/formats/ctf/ir/event-class.c +++ b/formats/ctf/ir/event-class.c @@ -355,7 +355,7 @@ int bt_ctf_event_class_set_payload_type(struct bt_ctf_event_class *event_class, if (!event_class || !payload || bt_ctf_field_type_get_type_id(payload) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { ret = -1; goto end; } @@ -380,7 +380,7 @@ int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class, } if (bt_ctf_field_type_get_type_id(event_class->fields) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { ret = -1; goto end; } @@ -403,7 +403,7 @@ int bt_ctf_event_class_get_field_count( } if (bt_ctf_field_type_get_type_id(event_class->fields) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { ret = -1; goto end; } @@ -426,7 +426,7 @@ int bt_ctf_event_class_get_field(struct bt_ctf_event_class *event_class, } if (bt_ctf_field_type_get_type_id(event_class->fields) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { ret = -1; goto end; } @@ -448,7 +448,7 @@ struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name( } if (bt_ctf_field_type_get_type_id(event_class->fields) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { goto end; } @@ -495,7 +495,7 @@ int bt_ctf_event_class_set_context_type( goto end; } - if (bt_ctf_field_type_get_type_id(context) != BT_CTF_TYPE_ID_STRUCT) { + if (bt_ctf_field_type_get_type_id(context) != CTF_TYPE_STRUCT) { ret = -1; goto end; } diff --git a/formats/ctf/ir/event.c b/formats/ctf/ir/event.c index f16a360b..4fa80a74 100644 --- a/formats/ctf/ir/event.c +++ b/formats/ctf/ir/event.c @@ -387,7 +387,7 @@ int bt_ctf_event_set_payload_field(struct bt_ctf_event *event, } if (bt_ctf_field_type_get_type_id(payload_type) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { ret = -1; goto end; } @@ -633,7 +633,7 @@ int set_integer_field_value(struct bt_ctf_field* field, uint64_t value) assert(field_type); if (bt_ctf_field_type_get_type_id(field_type) != - BT_CTF_TYPE_ID_INTEGER) { + CTF_TYPE_INTEGER) { /* Not an integer and the value is unset, error. */ ret = -1; goto end; diff --git a/formats/ctf/ir/field-types.c b/formats/ctf/ir/field-types.c index 95b91a6e..9af6b213 100644 --- a/formats/ctf/ir/field-types.c +++ b/formats/ctf/ir/field-types.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -76,16 +77,16 @@ void bt_ctf_field_type_string_destroy(struct bt_ctf_field_type *); static void (* const type_destroy_funcs[])(struct bt_ctf_field_type *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_destroy, - [BT_CTF_TYPE_ID_ENUM] = + [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_destroy, + [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_destroy, - [BT_CTF_TYPE_ID_FLOAT] = + [CTF_TYPE_FLOAT] = bt_ctf_field_type_floating_point_destroy, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_destroy, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_destroy, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_destroy, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_destroy, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_destroy, + [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_destroy, + [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_destroy, + [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_destroy, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_destroy, + [CTF_TYPE_STRING] = bt_ctf_field_type_string_destroy, }; static @@ -105,14 +106,14 @@ void bt_ctf_field_type_sequence_freeze(struct bt_ctf_field_type *); static type_freeze_func const type_freeze_funcs[] = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_freeze, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_freeze, - [BT_CTF_TYPE_ID_FLOAT] = generic_field_type_freeze, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_freeze, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_freeze, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_freeze, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_freeze, - [BT_CTF_TYPE_ID_STRING] = generic_field_type_freeze, + [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_freeze, + [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_freeze, + [CTF_TYPE_FLOAT] = generic_field_type_freeze, + [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_freeze, + [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_freeze, + [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_freeze, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_freeze, + [CTF_TYPE_STRING] = generic_field_type_freeze, }; static @@ -142,17 +143,17 @@ int bt_ctf_field_type_string_serialize(struct bt_ctf_field_type *, static type_serialize_func const type_serialize_funcs[] = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_serialize, - [BT_CTF_TYPE_ID_ENUM] = + [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_serialize, + [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_serialize, - [BT_CTF_TYPE_ID_FLOAT] = + [CTF_TYPE_FLOAT] = bt_ctf_field_type_floating_point_serialize, - [BT_CTF_TYPE_ID_STRUCT] = + [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_serialize, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_serialize, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_serialize, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_serialize, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_serialize, + [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_serialize, + [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_serialize, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_serialize, + [CTF_TYPE_STRING] = bt_ctf_field_type_string_serialize, }; static @@ -181,17 +182,17 @@ void bt_ctf_field_type_sequence_set_byte_order(struct bt_ctf_field_type *, static void (* const set_byte_order_funcs[])(struct bt_ctf_field_type *, int byte_order, int set_native) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_set_byte_order, - [BT_CTF_TYPE_ID_ENUM] = + [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_set_byte_order, + [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_set_byte_order, - [BT_CTF_TYPE_ID_FLOAT] = + [CTF_TYPE_FLOAT] = bt_ctf_field_type_floating_point_set_byte_order, - [BT_CTF_TYPE_ID_STRUCT] = + [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_set_byte_order, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_set_byte_order, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_set_byte_order, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_set_byte_order, - [BT_CTF_TYPE_ID_STRING] = NULL, + [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_set_byte_order, + [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_set_byte_order, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_set_byte_order, + [CTF_TYPE_STRING] = NULL, }; static @@ -222,14 +223,14 @@ struct bt_ctf_field_type *bt_ctf_field_type_string_copy( static struct bt_ctf_field_type *(* const type_copy_funcs[])( struct bt_ctf_field_type *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_copy, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_copy, - [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_copy, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_copy, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_copy, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_copy, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_copy, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_copy, + [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_copy, + [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_copy, + [CTF_TYPE_FLOAT] = bt_ctf_field_type_floating_point_copy, + [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_copy, + [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_copy, + [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_copy, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_copy, + [CTF_TYPE_STRING] = bt_ctf_field_type_string_copy, }; static @@ -260,14 +261,14 @@ int bt_ctf_field_type_sequence_compare(struct bt_ctf_field_type *, static int (* const type_compare_funcs[])(struct bt_ctf_field_type *, struct bt_ctf_field_type *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_compare, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_compare, - [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_compare, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_compare, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_compare, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_compare, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_compare, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_compare, + [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_compare, + [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_compare, + [CTF_TYPE_FLOAT] = bt_ctf_field_type_floating_point_compare, + [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_compare, + [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_compare, + [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_compare, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_compare, + [CTF_TYPE_STRING] = bt_ctf_field_type_string_compare, }; static @@ -285,14 +286,14 @@ int bt_ctf_field_type_sequence_validate(struct bt_ctf_field_type *); static int (* const type_validate_funcs[])(struct bt_ctf_field_type *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_validate, - [BT_CTF_TYPE_ID_FLOAT] = NULL, - [BT_CTF_TYPE_ID_STRING] = NULL, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_validate, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_validate, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_validate, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_validate, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_validate, + [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_validate, + [CTF_TYPE_FLOAT] = NULL, + [CTF_TYPE_STRING] = NULL, + [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_validate, + [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_validate, + [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_validate, + [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_validate, + [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_validate, }; static @@ -359,10 +360,10 @@ gint compare_enumeration_mappings_unsigned(struct enumeration_mapping **a, static void bt_ctf_field_type_init(struct bt_ctf_field_type *type, int init_bo) { - enum bt_ctf_type_id type_id = type->declaration->id; + enum ctf_type_id type_id = type->declaration->id; - assert(type && (type_id > BT_CTF_TYPE_ID_UNKNOWN) && - (type_id < BT_CTF_NR_TYPE_IDS)); + assert(type && (type_id > CTF_TYPE_UNKNOWN) && + (type_id < NR_CTF_TYPES)); bt_object_init(type, bt_ctf_field_type_destroy); type->freeze = type_freeze_funcs[type_id]; @@ -415,12 +416,12 @@ static void bt_ctf_field_type_destroy(struct bt_object *obj) { struct bt_ctf_field_type *type; - enum bt_ctf_type_id type_id; + enum ctf_type_id type_id; type = container_of(obj, struct bt_ctf_field_type, base); type_id = type->declaration->id; - 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; } @@ -646,7 +647,7 @@ BT_HIDDEN int bt_ctf_field_type_validate(struct bt_ctf_field_type *type) { int ret = 0; - enum bt_ctf_type_id id = bt_ctf_field_type_get_type_id(type); + enum ctf_type_id id = bt_ctf_field_type_get_type_id(type); if (!type) { ret = -1; @@ -681,7 +682,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_integer_create(unsigned int size) } integer->parent.declaration = &integer->declaration.p; - integer->parent.declaration->id = BT_CTF_TYPE_ID_INTEGER; + integer->parent.declaration->id = CTF_TYPE_INTEGER; integer->declaration.len = size; integer->declaration.base = BT_CTF_INTEGER_BASE_DECIMAL; integer->declaration.encoding = BT_CTF_STRING_ENCODING_NONE; @@ -695,7 +696,7 @@ int bt_ctf_field_type_integer_get_size(struct bt_ctf_field_type *type) int ret = 0; struct bt_ctf_field_type_integer *integer; - if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) { + if (!type || type->declaration->id != CTF_TYPE_INTEGER) { ret = -1; goto end; } @@ -711,7 +712,7 @@ int bt_ctf_field_type_integer_get_signed(struct bt_ctf_field_type *type) int ret = 0; struct bt_ctf_field_type_integer *integer; - if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) { + if (!type || type->declaration->id != CTF_TYPE_INTEGER) { ret = -1; goto end; } @@ -729,7 +730,7 @@ int bt_ctf_field_type_integer_set_signed(struct bt_ctf_field_type *type, struct bt_ctf_field_type_integer *integer; if (!type || type->frozen || - type->declaration->id != BT_CTF_TYPE_ID_INTEGER) { + type->declaration->id != CTF_TYPE_INTEGER) { ret = -1; goto end; } @@ -747,7 +748,7 @@ enum bt_ctf_integer_base bt_ctf_field_type_integer_get_base( enum bt_ctf_integer_base ret = BT_CTF_INTEGER_BASE_UNKNOWN; struct bt_ctf_field_type_integer *integer; - if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) { + if (!type || type->declaration->id != CTF_TYPE_INTEGER) { goto end; } @@ -763,7 +764,7 @@ int bt_ctf_field_type_integer_set_base(struct bt_ctf_field_type *type, int ret = 0; if (!type || type->frozen || - type->declaration->id != BT_CTF_TYPE_ID_INTEGER) { + type->declaration->id != CTF_TYPE_INTEGER) { ret = -1; goto end; } @@ -793,7 +794,7 @@ enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding( enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN; struct bt_ctf_field_type_integer *integer; - if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) { + if (!type || type->declaration->id != CTF_TYPE_INTEGER) { goto end; } @@ -810,7 +811,7 @@ int bt_ctf_field_type_integer_set_encoding(struct bt_ctf_field_type *type, struct bt_ctf_field_type_integer *integer; if (!type || type->frozen || - (type->declaration->id != BT_CTF_TYPE_ID_INTEGER) || + (type->declaration->id != CTF_TYPE_INTEGER) || (encoding < BT_CTF_STRING_ENCODING_NONE) || (encoding >= BT_CTF_STRING_ENCODING_UNKNOWN)) { ret = -1; @@ -871,7 +872,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create( goto error; } - if (integer_container_type->declaration->id != BT_CTF_TYPE_ID_INTEGER) { + if (integer_container_type->declaration->id != CTF_TYPE_INTEGER) { goto error; } @@ -881,7 +882,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create( } enumeration->parent.declaration = &enumeration->declaration.p; - enumeration->parent.declaration->id = BT_CTF_TYPE_ID_ENUM; + enumeration->parent.declaration->id = CTF_TYPE_ENUM; bt_get(integer_container_type); enumeration->container = integer_container_type; enumeration->entries = g_ptr_array_new_with_free_func( @@ -904,7 +905,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_enumeration_get_container_type( goto end; } - if (type->declaration->id != BT_CTF_TYPE_ID_ENUM) { + if (type->declaration->id != CTF_TYPE_ENUM) { goto end; } @@ -927,7 +928,7 @@ int bt_ctf_field_type_enumeration_add_mapping( struct range_overlap_query query; char *escaped_string; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM) || + if (!type || (type->declaration->id != CTF_TYPE_ENUM) || type->frozen || (range_end < range_start)) { ret = -1; @@ -991,7 +992,7 @@ int bt_ctf_field_type_enumeration_add_mapping_unsigned( struct range_overlap_query query; char *escaped_string; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM) || + if (!type || (type->declaration->id != CTF_TYPE_ENUM) || type->frozen || (range_end < range_start)) { ret = -1; @@ -1096,7 +1097,7 @@ int bt_ctf_field_type_enumeration_get_mapping_count( int ret = 0; struct bt_ctf_field_type_enumeration *enumeration; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) { + if (!type || (type->declaration->id != CTF_TYPE_ENUM)) { ret = -1; goto end; } @@ -1135,7 +1136,7 @@ int bt_ctf_field_type_enumeration_get_mapping( int ret = 0; if (!type || index < 0 || !string || !range_start || !range_end || - (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) { + (type->declaration->id != CTF_TYPE_ENUM)) { ret = -1; goto end; } @@ -1162,7 +1163,7 @@ int bt_ctf_field_type_enumeration_get_mapping_unsigned( int ret = 0; if (!type || index < 0 || !string || !range_start || !range_end || - (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) { + (type->declaration->id != CTF_TYPE_ENUM)) { ret = -1; goto end; } @@ -1189,7 +1190,7 @@ int bt_ctf_field_type_enumeration_get_mapping_index_by_name( int i, ret = 0; if (!type || !name || - (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) { + (type->declaration->id != CTF_TYPE_ENUM)) { ret = -1; goto end; } @@ -1224,7 +1225,7 @@ int bt_ctf_field_type_enumeration_get_mapping_index_by_value( struct bt_ctf_field_type_enumeration *enumeration; int i, ret = 0; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) { + if (!type || (type->declaration->id != CTF_TYPE_ENUM)) { ret = -1; goto end; } @@ -1254,7 +1255,7 @@ int bt_ctf_field_type_enumeration_get_mapping_index_by_unsigned_value( struct bt_ctf_field_type_enumeration *enumeration; int i, ret = 0; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) { + if (!type || (type->declaration->id != CTF_TYPE_ENUM)) { ret = -1; goto end; } @@ -1291,7 +1292,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_floating_point_create(void) floating_point->declaration.exp = &floating_point->exp; floating_point->sign.len = 1; floating_point->parent.declaration = &floating_point->declaration.p; - floating_point->parent.declaration->id = BT_CTF_TYPE_ID_FLOAT; + floating_point->parent.declaration->id = CTF_TYPE_FLOAT; floating_point->declaration.exp->len = sizeof(float) * CHAR_BIT - FLT_MANT_DIG; floating_point->declaration.mantissa->len = FLT_MANT_DIG - 1; @@ -1311,7 +1312,7 @@ int bt_ctf_field_type_floating_point_get_exponent_digits( int ret = 0; struct bt_ctf_field_type_floating_point *floating_point; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) { + if (!type || (type->declaration->id != CTF_TYPE_FLOAT)) { ret = -1; goto end; } @@ -1331,7 +1332,7 @@ int bt_ctf_field_type_floating_point_set_exponent_digits( struct bt_ctf_field_type_floating_point *floating_point; if (!type || type->frozen || - (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) { + (type->declaration->id != CTF_TYPE_FLOAT)) { ret = -1; goto end; } @@ -1358,7 +1359,7 @@ int bt_ctf_field_type_floating_point_get_mantissa_digits( int ret = 0; struct bt_ctf_field_type_floating_point *floating_point; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) { + if (!type || (type->declaration->id != CTF_TYPE_FLOAT)) { ret = -1; goto end; } @@ -1378,7 +1379,7 @@ int bt_ctf_field_type_floating_point_set_mantissa_digits( struct bt_ctf_field_type_floating_point *floating_point; if (!type || type->frozen || - (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) { + (type->declaration->id != CTF_TYPE_FLOAT)) { ret = -1; goto end; } @@ -1408,7 +1409,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_structure_create(void) } structure->parent.declaration = &structure->declaration.p; - structure->parent.declaration->id = BT_CTF_TYPE_ID_STRUCT; + structure->parent.declaration->id = CTF_TYPE_STRUCT; structure->fields = g_ptr_array_new_with_free_func( (GDestroyNotify)destroy_structure_field); structure->field_name_to_index = g_hash_table_new(NULL, NULL); @@ -1427,7 +1428,7 @@ int bt_ctf_field_type_structure_add_field(struct bt_ctf_field_type *type, if (!type || !field_type || type->frozen || bt_ctf_validate_identifier(field_name) || - (type->declaration->id != BT_CTF_TYPE_ID_STRUCT)) { + (type->declaration->id != CTF_TYPE_STRUCT)) { ret = -1; goto end; } @@ -1450,7 +1451,7 @@ int bt_ctf_field_type_structure_get_field_count( int ret = 0; struct bt_ctf_field_type_structure *structure; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_STRUCT)) { + if (!type || (type->declaration->id != CTF_TYPE_STRUCT)) { ret = -1; goto end; } @@ -1471,7 +1472,7 @@ int bt_ctf_field_type_structure_get_field(struct bt_ctf_field_type *type, int ret = 0; if (!type || index < 0 || - (type->declaration->id != BT_CTF_TYPE_ID_STRUCT)) { + (type->declaration->id != CTF_TYPE_STRUCT)) { ret = -1; goto end; } @@ -1544,7 +1545,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_create( } variant->parent.declaration = &variant->declaration.p; - variant->parent.declaration->id = BT_CTF_TYPE_ID_VARIANT; + variant->parent.declaration->id = CTF_TYPE_VARIANT; variant->tag_name = g_string_new(tag_name); variant->field_name_to_index = g_hash_table_new(NULL, NULL); variant->fields = g_ptr_array_new_with_free_func( @@ -1570,7 +1571,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_tag_type( struct bt_ctf_field_type_variant *variant; struct bt_ctf_field_type *tag_type = NULL; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) { + if (!type || (type->declaration->id != CTF_TYPE_VARIANT)) { goto end; } @@ -1592,7 +1593,7 @@ const char *bt_ctf_field_type_variant_get_tag_name( struct bt_ctf_field_type_variant *variant; const char *tag_name = NULL; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) { + if (!type || (type->declaration->id != CTF_TYPE_VARIANT)) { goto end; } @@ -1614,7 +1615,7 @@ int bt_ctf_field_type_variant_set_tag_name( struct bt_ctf_field_type_variant *variant; if (!type || type->frozen || - (type->declaration->id != BT_CTF_TYPE_ID_VARIANT) || + (type->declaration->id != CTF_TYPE_VARIANT) || bt_ctf_validate_identifier(name)) { ret = -1; goto end; @@ -1637,7 +1638,7 @@ int bt_ctf_field_type_variant_add_field(struct bt_ctf_field_type *type, if (!type || !field_type || type->frozen || bt_ctf_validate_identifier(field_name) || - (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) { + (type->declaration->id != CTF_TYPE_VARIANT)) { ret = -1; goto end; } @@ -1716,7 +1717,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag( const char *enum_value; struct bt_ctf_field_type *field_type = NULL; - if (!type || !tag || type->declaration->id != BT_CTF_TYPE_ID_VARIANT) { + if (!type || !tag || type->declaration->id != CTF_TYPE_VARIANT) { goto end; } @@ -1737,7 +1738,7 @@ int bt_ctf_field_type_variant_get_field_count(struct bt_ctf_field_type *type) int ret = 0; struct bt_ctf_field_type_variant *variant; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) { + if (!type || (type->declaration->id != CTF_TYPE_VARIANT)) { ret = -1; goto end; } @@ -1760,7 +1761,7 @@ int bt_ctf_field_type_variant_get_field(struct bt_ctf_field_type *type, int ret = 0; if (!type || index < 0 || - (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) { + (type->declaration->id != CTF_TYPE_VARIANT)) { ret = -1; goto end; } @@ -1800,7 +1801,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_array_create( } array->parent.declaration = &array->declaration.p; - array->parent.declaration->id = BT_CTF_TYPE_ID_ARRAY; + array->parent.declaration->id = CTF_TYPE_ARRAY; bt_get(element_type); array->element_type = element_type; @@ -1818,7 +1819,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_array_get_element_type( struct bt_ctf_field_type *ret = NULL; struct bt_ctf_field_type_array *array; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ARRAY)) { + if (!type || (type->declaration->id != CTF_TYPE_ARRAY)) { goto end; } @@ -1837,7 +1838,7 @@ int bt_ctf_field_type_array_set_element_type(struct bt_ctf_field_type *type, struct bt_ctf_field_type_array *array; if (!type || !element_type || - (type->declaration->id != BT_CTF_TYPE_ID_ARRAY)) { + (type->declaration->id != CTF_TYPE_ARRAY)) { ret = -1; goto end; } @@ -1861,7 +1862,7 @@ int64_t bt_ctf_field_type_array_get_length(struct bt_ctf_field_type *type) int64_t ret; struct bt_ctf_field_type_array *array; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ARRAY)) { + if (!type || (type->declaration->id != CTF_TYPE_ARRAY)) { ret = -1; goto end; } @@ -1888,7 +1889,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_sequence_create( } sequence->parent.declaration = &sequence->declaration.p; - sequence->parent.declaration->id = BT_CTF_TYPE_ID_SEQUENCE; + sequence->parent.declaration->id = CTF_TYPE_SEQUENCE; bt_get(element_type); sequence->element_type = element_type; sequence->length_field_name = g_string_new(length_field_name); @@ -1905,7 +1906,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_sequence_get_element_type( struct bt_ctf_field_type *ret = NULL; struct bt_ctf_field_type_sequence *sequence; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_SEQUENCE)) { + if (!type || (type->declaration->id != CTF_TYPE_SEQUENCE)) { goto end; } @@ -1925,7 +1926,7 @@ int bt_ctf_field_type_sequence_set_element_type(struct bt_ctf_field_type *type, struct bt_ctf_field_type_sequence *sequence; if (!type || !element_type || - (type->declaration->id != BT_CTF_TYPE_ID_SEQUENCE)) { + (type->declaration->id != CTF_TYPE_SEQUENCE)) { ret = -1; goto end; } @@ -1950,7 +1951,7 @@ const char *bt_ctf_field_type_sequence_get_length_field_name( const char *ret = NULL; struct bt_ctf_field_type_sequence *sequence; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_SEQUENCE)) { + if (!type || (type->declaration->id != CTF_TYPE_SEQUENCE)) { goto end; } @@ -1971,7 +1972,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_string_create(void) } string->parent.declaration = &string->declaration.p; - string->parent.declaration->id = BT_CTF_TYPE_ID_STRING; + string->parent.declaration->id = CTF_TYPE_STRING; bt_ctf_field_type_init(&string->parent, TRUE); string->declaration.encoding = BT_CTF_STRING_ENCODING_UTF8; string->parent.declaration->alignment = CHAR_BIT; @@ -1985,7 +1986,7 @@ enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding( struct bt_ctf_field_type_string *string; enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN; - if (!type || (type->declaration->id != BT_CTF_TYPE_ID_STRING)) { + if (!type || (type->declaration->id != CTF_TYPE_STRING)) { goto end; } @@ -2002,7 +2003,7 @@ int bt_ctf_field_type_string_set_encoding(struct bt_ctf_field_type *type, int ret = 0; struct bt_ctf_field_type_string *string; - if (!type || type->declaration->id != BT_CTF_TYPE_ID_STRING || + if (!type || type->declaration->id != CTF_TYPE_STRING || (encoding != BT_CTF_STRING_ENCODING_UTF8 && encoding != BT_CTF_STRING_ENCODING_ASCII)) { ret = -1; @@ -2019,7 +2020,7 @@ BT_HIDDEN int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) { int ret; - enum bt_ctf_type_id type_id; + enum ctf_type_id type_id; if (!type) { ret = -1; @@ -2033,7 +2034,7 @@ int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) type_id = bt_ctf_field_type_get_type_id(type); switch (type_id) { - case BT_CTF_TYPE_ID_SEQUENCE: + case CTF_TYPE_SEQUENCE: { struct bt_ctf_field_type *element = bt_ctf_field_type_sequence_get_element_type(type); @@ -2047,7 +2048,7 @@ int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) bt_put(element); break; } - case BT_CTF_TYPE_ID_ARRAY: + case CTF_TYPE_ARRAY: { struct bt_ctf_field_type *element = bt_ctf_field_type_array_get_element_type(type); @@ -2061,7 +2062,7 @@ int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) bt_put(element); break; } - case BT_CTF_TYPE_ID_STRUCT: + case CTF_TYPE_STRUCT: { int i, element_count; @@ -2097,7 +2098,7 @@ int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) ret = (int) type->declaration->alignment; break; } - case BT_CTF_TYPE_ID_UNKNOWN: + case CTF_TYPE_UNKNOWN: ret = -1; break; default: @@ -2118,7 +2119,7 @@ int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *type, unsigned int alignment) { int ret = 0; - enum bt_ctf_type_id type_id; + enum ctf_type_id type_id; /* Alignment must be a power of two */ if (!type || type->frozen || !is_power_of_two(alignment)) { @@ -2127,20 +2128,20 @@ int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *type, } type_id = bt_ctf_field_type_get_type_id(type); - if (type_id == BT_CTF_TYPE_ID_UNKNOWN) { + if (type_id == CTF_TYPE_UNKNOWN) { ret = -1; goto end; } - if (type->declaration->id == BT_CTF_TYPE_ID_STRING && + if (type->declaration->id == CTF_TYPE_STRING && alignment != CHAR_BIT) { ret = -1; goto end; } - if (type_id == BT_CTF_TYPE_ID_VARIANT || - type_id == BT_CTF_TYPE_ID_SEQUENCE || - type_id == BT_CTF_TYPE_ID_ARRAY) { + if (type_id == CTF_TYPE_VARIANT || + type_id == CTF_TYPE_SEQUENCE || + type_id == CTF_TYPE_ARRAY) { /* Setting an alignment on these types makes no sense */ ret = -1; goto end; @@ -2163,14 +2164,14 @@ enum bt_ctf_byte_order bt_ctf_field_type_get_byte_order( } switch (type->declaration->id) { - case BT_CTF_TYPE_ID_INTEGER: + case CTF_TYPE_INTEGER: { struct bt_ctf_field_type_integer *integer = container_of( type, struct bt_ctf_field_type_integer, parent); ret = integer->user_byte_order; break; } - case BT_CTF_TYPE_ID_FLOAT: + case CTF_TYPE_FLOAT: { struct bt_ctf_field_type_floating_point *floating_point = container_of(type, @@ -2197,7 +2198,7 @@ int bt_ctf_field_type_set_byte_order(struct bt_ctf_field_type *type, { int ret = 0; int internal_byte_order; - enum bt_ctf_type_id type_id; + enum ctf_type_id type_id; if (!type || type->frozen) { ret = -1; @@ -2230,11 +2231,11 @@ end: } BT_HIDDEN -enum bt_ctf_type_id bt_ctf_field_type_get_type_id( +enum ctf_type_id bt_ctf_field_type_get_type_id( struct bt_ctf_field_type *type) { if (!type) { - return BT_CTF_TYPE_ID_UNKNOWN; + return CTF_TYPE_UNKNOWN; } return type->declaration->id; @@ -2243,49 +2244,49 @@ enum bt_ctf_type_id bt_ctf_field_type_get_type_id( BT_HIDDEN int bt_ctf_field_type_is_integer(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_INTEGER; + return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_INTEGER; } BT_HIDDEN int bt_ctf_field_type_is_floating_point(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_FLOAT; + return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_FLOAT; } BT_HIDDEN int bt_ctf_field_type_is_enumeration(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_ENUM; + return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_ENUM; } BT_HIDDEN int bt_ctf_field_type_is_string(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_STRING; + return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_STRING; } BT_HIDDEN int bt_ctf_field_type_is_structure(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_STRUCT; + return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_STRUCT; } BT_HIDDEN int bt_ctf_field_type_is_array(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_ARRAY; + return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_ARRAY; } BT_HIDDEN int bt_ctf_field_type_is_sequence(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_SEQUENCE; + return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_SEQUENCE; } BT_HIDDEN int bt_ctf_field_type_is_variant(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_VARIANT; + return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_VARIANT; } void bt_ctf_field_type_get(struct bt_ctf_field_type *type) @@ -2435,7 +2436,7 @@ int bt_ctf_field_type_structure_get_field_name_index( struct bt_ctf_field_type_structure *structure; if (!type || !name || - bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_STRUCT) { + bt_ctf_field_type_get_type_id(type) != CTF_TYPE_STRUCT) { ret = -1; goto end; } @@ -2466,7 +2467,7 @@ int bt_ctf_field_type_structure_set_field_index(struct bt_ctf_field_type *type, struct bt_ctf_field_type_structure *structure; if (!type || !field || - bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_STRUCT) { + bt_ctf_field_type_get_type_id(type) != CTF_TYPE_STRUCT) { ret = -1; goto end; } @@ -2497,7 +2498,7 @@ int bt_ctf_field_type_variant_get_field_name_index( struct bt_ctf_field_type_variant *variant; if (!type || !name || - bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_VARIANT) { + bt_ctf_field_type_get_type_id(type) != CTF_TYPE_VARIANT) { ret = -1; goto end; } @@ -2529,7 +2530,7 @@ int bt_ctf_field_type_sequence_set_length_field_path( struct bt_ctf_field_type_sequence *sequence; if (!type || bt_ctf_field_type_get_type_id(type) != - BT_CTF_TYPE_ID_SEQUENCE) { + CTF_TYPE_SEQUENCE) { ret = -1; goto end; } @@ -2550,7 +2551,7 @@ int bt_ctf_field_type_variant_set_tag_field_path(struct bt_ctf_field_type *type, struct bt_ctf_field_type_variant *variant; if (!type || bt_ctf_field_type_get_type_id(type) != - BT_CTF_TYPE_ID_VARIANT) { + CTF_TYPE_VARIANT) { ret = -1; goto end; } @@ -2572,7 +2573,7 @@ int bt_ctf_field_type_variant_set_tag_field_type(struct bt_ctf_field_type *type, if (!type || !tag || bt_ctf_field_type_get_type_id(tag) != - BT_CTF_TYPE_ID_ENUM) { + CTF_TYPE_ENUM) { ret = -1; goto end; } @@ -2597,7 +2598,7 @@ int bt_ctf_field_type_variant_set_field_index(struct bt_ctf_field_type *type, struct bt_ctf_field_type_variant *variant; if (!type || !field || - bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_VARIANT) { + bt_ctf_field_type_get_type_id(type) != CTF_TYPE_VARIANT) { ret = -1; goto end; } @@ -4049,7 +4050,7 @@ int bt_ctf_field_type_compare(struct bt_ctf_field_type *type_a, goto end; } - if (type_a->declaration->id == BT_CTF_TYPE_ID_UNKNOWN) { + if (type_a->declaration->id == CTF_TYPE_UNKNOWN) { /* Both have unknown type IDs */ goto end; } 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; } diff --git a/formats/ctf/ir/packet.c b/formats/ctf/ir/packet.c index a94d2677..22948b3b 100644 --- a/formats/ctf/ir/packet.c +++ b/formats/ctf/ir/packet.c @@ -25,6 +25,7 @@ */ #include +#include #include #include #include diff --git a/formats/ctf/ir/resolve.c b/formats/ctf/ir/resolve.c index 819f65ba..2da1c749 100644 --- a/formats/ctf/ir/resolve.c +++ b/formats/ctf/ir/resolve.c @@ -246,7 +246,7 @@ void type_stack_pop(type_stack *stack) */ static struct bt_ctf_field_type *get_type_from_ctx(struct resolve_context *ctx, - enum bt_ctf_scope scope) + enum bt_ctf_ir_scope scope) { assert(scope >= BT_CTF_SCOPE_TRACE_PACKET_HEADER && scope <= BT_CTF_SCOPE_EVENT_FIELDS); @@ -599,7 +599,7 @@ struct bt_ctf_field_path *pathstr_to_field_path(const char *pathstr, struct resolve_context *ctx) { int ret; - enum bt_ctf_scope root_scope; + enum bt_ctf_ir_scope root_scope; GList *ptokens = NULL; struct bt_ctf_field_path *field_path = NULL; diff --git a/formats/ctf/ir/stream-class.c b/formats/ctf/ir/stream-class.c index bdd9c13c..c5b1b15f 100644 --- a/formats/ctf/ir/stream-class.c +++ b/formats/ctf/ir/stream-class.c @@ -597,7 +597,7 @@ int bt_ctf_stream_class_set_packet_context_type( goto end; } if (bt_ctf_field_type_get_type_id(packet_context_type) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { /* A packet context must be a structure */ ret = -1; goto end; @@ -644,7 +644,7 @@ int bt_ctf_stream_class_set_event_header_type( goto end; } if (bt_ctf_field_type_get_type_id(event_header_type) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { /* An event header must be a structure */ ret = -1; goto end; @@ -687,7 +687,7 @@ int bt_ctf_stream_class_set_event_context_type( } if (bt_ctf_field_type_get_type_id(event_context_type) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { /* A packet context must be a structure */ ret = -1; goto end; diff --git a/formats/ctf/ir/stream.c b/formats/ctf/ir/stream.c index c757be71..9cba9c5d 100644 --- a/formats/ctf/ir/stream.c +++ b/formats/ctf/ir/stream.c @@ -70,7 +70,7 @@ int set_packet_header_magic(struct bt_ctf_stream *stream) assert(magic_field_type); if (bt_ctf_field_type_get_type_id(magic_field_type) != - BT_CTF_TYPE_ID_INTEGER) { + CTF_TYPE_INTEGER) { /* Magic field is not an integer. Not an error, skip. */ goto end; } @@ -121,7 +121,7 @@ int set_packet_header_uuid(struct bt_ctf_stream *stream) uuid_field_type = bt_ctf_field_get_type(uuid_field); assert(uuid_field_type); if (bt_ctf_field_type_get_type_id(uuid_field_type) != - BT_CTF_TYPE_ID_ARRAY) { + CTF_TYPE_ARRAY) { /* UUID field is not an array. Not an error, skip. */ goto end; } @@ -138,7 +138,7 @@ int set_packet_header_uuid(struct bt_ctf_stream *stream) uuid_field_type); assert(element_field_type); if (bt_ctf_field_type_get_type_id(element_field_type) != - BT_CTF_TYPE_ID_INTEGER) { + CTF_TYPE_INTEGER) { /* UUID array elements are not integers. Not an error, skip */ goto end; } @@ -194,7 +194,7 @@ int set_packet_header_stream_id(struct bt_ctf_stream *stream) stream_id_field_type = bt_ctf_field_get_type(stream_id_field); assert(stream_id_field_type); if (bt_ctf_field_type_get_type_id(stream_id_field_type) != - BT_CTF_TYPE_ID_INTEGER) { + CTF_TYPE_INTEGER) { /* stream_id field is not an integer. Not an error, skip. */ goto end; } @@ -724,7 +724,7 @@ int get_event_header_timestamp(struct bt_ctf_field *event_header, uint64_t *time timestamp_field_type = bt_ctf_field_get_type(timestamp_field); assert(timestamp_field_type); if (bt_ctf_field_type_get_type_id(timestamp_field_type) != - BT_CTF_TYPE_ID_INTEGER) { + CTF_TYPE_INTEGER) { ret = -1; goto end; } @@ -977,7 +977,7 @@ int set_structure_field_integer(struct bt_ctf_field *structure, char *name, field_type = bt_ctf_field_get_type(integer); /* Something is serioulsly wrong */ assert(field_type); - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) { + if (bt_ctf_field_type_get_type_id(field_type) != CTF_TYPE_INTEGER) { /* * The user most likely meant for us to populate this field * automatically. However, we can only do this if the field diff --git a/formats/ctf/ir/trace.c b/formats/ctf/ir/trace.c index 60f2a2c4..a84279d2 100644 --- a/formats/ctf/ir/trace.c +++ b/formats/ctf/ir/trace.c @@ -1037,7 +1037,7 @@ int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace *trace, /* packet_header_type must be a structure */ if (bt_ctf_field_type_get_type_id(packet_header_type) != - BT_CTF_TYPE_ID_STRUCT) { + CTF_TYPE_STRUCT) { ret = -1; goto end; } diff --git a/formats/ctf/ir/validation.c b/formats/ctf/ir/validation.c index f3a2c71e..8ea23a5b 100644 --- a/formats/ctf/ir/validation.c +++ b/formats/ctf/ir/validation.c @@ -190,15 +190,15 @@ static int field_type_contains_sequence_or_variant_ft(struct bt_ctf_field_type *type) { int ret = 0; - enum bt_ctf_type_id type_id = bt_ctf_field_type_get_type_id(type); + enum ctf_type_id type_id = bt_ctf_field_type_get_type_id(type); switch (type_id) { - case BT_CTF_TYPE_ID_SEQUENCE: - case BT_CTF_TYPE_ID_VARIANT: + case CTF_TYPE_SEQUENCE: + case CTF_TYPE_VARIANT: ret = 1; goto end; - case BT_CTF_TYPE_ID_ARRAY: - case BT_CTF_TYPE_ID_STRUCT: + case CTF_TYPE_ARRAY: + case CTF_TYPE_STRUCT: { int i; int field_count = bt_ctf_field_type_get_field_count(type); diff --git a/include/babeltrace/ctf-ir/field-path-internal.h b/include/babeltrace/ctf-ir/field-path-internal.h index de08a87e..c679130a 100644 --- a/include/babeltrace/ctf-ir/field-path-internal.h +++ b/include/babeltrace/ctf-ir/field-path-internal.h @@ -33,7 +33,7 @@ struct bt_ctf_field_path { struct bt_object base; - enum bt_ctf_scope root; + enum bt_ctf_ir_scope root; /* * Array of integers (int) indicating the index in either diff --git a/include/babeltrace/ctf-ir/field-types-internal.h b/include/babeltrace/ctf-ir/field-types-internal.h index 18ddee65..d248797f 100644 --- a/include/babeltrace/ctf-ir/field-types-internal.h +++ b/include/babeltrace/ctf-ir/field-types-internal.h @@ -41,20 +41,6 @@ typedef void (*type_freeze_func)(struct bt_ctf_field_type *); typedef int (*type_serialize_func)(struct bt_ctf_field_type *, struct metadata_context *); -enum bt_ctf_type_id { - BT_CTF_TYPE_ID_UNKNOWN = CTF_TYPE_UNKNOWN, - BT_CTF_TYPE_ID_INTEGER = CTF_TYPE_INTEGER, - BT_CTF_TYPE_ID_FLOAT = CTF_TYPE_FLOAT, - BT_CTF_TYPE_ID_ENUM = CTF_TYPE_ENUM, - BT_CTF_TYPE_ID_STRING = CTF_TYPE_STRING, - BT_CTF_TYPE_ID_STRUCT = CTF_TYPE_STRUCT, - BT_CTF_TYPE_ID_UNTAGGED_VARIANT = CTF_TYPE_UNTAGGED_VARIANT, - BT_CTF_TYPE_ID_VARIANT = CTF_TYPE_VARIANT, - BT_CTF_TYPE_ID_ARRAY = CTF_TYPE_ARRAY, - BT_CTF_TYPE_ID_SEQUENCE = CTF_TYPE_SEQUENCE, - BT_CTF_NR_TYPE_IDS, -}; - enum bt_ctf_ir_scope { BT_CTF_SCOPE_UNKNOWN = -1, BT_CTF_SCOPE_ENV = 0, @@ -728,7 +714,7 @@ int bt_ctf_field_type_compare(struct bt_ctf_field_type *type_a, * Returns the field type's bt_ctf_type_id, CTF_TYPE_UNKNOWN on error. */ BT_HIDDEN -enum bt_ctf_type_id bt_ctf_field_type_get_type_id( +enum ctf_type_id bt_ctf_field_type_get_type_id( struct bt_ctf_field_type *type); /* diff --git a/include/babeltrace/ctf-ir/fields-internal.h b/include/babeltrace/ctf-ir/fields-internal.h index b007783b..b657ee4f 100644 --- a/include/babeltrace/ctf-ir/fields-internal.h +++ b/include/babeltrace/ctf-ir/fields-internal.h @@ -378,7 +378,7 @@ int bt_ctf_field_string_append_len( * Returns the field's ctf_type_id, CTF_TYPE_UNKNOWN on error. */ 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); /* * bt_ctf_field_get_type: get a field's type -- 2.34.1