Do not use `bool` type; use new `bt_bool` instead
[babeltrace.git] / lib / ctf-ir / fields.c
index eb98259a51e7077f177267d7b8e6c64712471370..5223d778ffbcda1101726d3a96ed8e1d7f36acde 100644 (file)
@@ -31,9 +31,9 @@
 #include <babeltrace/ctf-writer/serialize-internal.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/ref.h>
-#include <babeltrace/compiler.h>
-#include <babeltrace/compat/fcntl.h>
-#include <babeltrace/align.h>
+#include <babeltrace/compiler-internal.h>
+#include <babeltrace/compat/fcntl-internal.h>
+#include <babeltrace/align-internal.h>
 
 #define PACKET_LEN_INCREMENT   (getpagesize() * 8 * CHAR_BIT)
 
@@ -164,17 +164,17 @@ static
 void bt_ctf_field_sequence_freeze(struct bt_ctf_field *);
 
 static
-bool bt_ctf_field_generic_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_generic_is_set(struct bt_ctf_field *);
 static
-bool bt_ctf_field_structure_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_structure_is_set(struct bt_ctf_field *);
 static
-bool bt_ctf_field_variant_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_variant_is_set(struct bt_ctf_field *);
 static
-bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *);
 static
-bool bt_ctf_field_array_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_array_is_set(struct bt_ctf_field *);
 static
-bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *);
 
 static
 int increase_packet_size(struct bt_ctf_stream_pos *pos);
@@ -182,109 +182,109 @@ int increase_packet_size(struct bt_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] =
+       [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_create,
+       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_create,
+       [BT_CTF_FIELD_TYPE_ID_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,
+       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_create,
+       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_create,
+       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_create,
+       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_create,
+       [BT_CTF_FIELD_TYPE_ID_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] =
+       [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_destroy,
+       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_destroy,
+       [BT_CTF_FIELD_TYPE_ID_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,
+       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_destroy,
+       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_destroy,
+       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_destroy,
+       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_destroy,
+       [BT_CTF_FIELD_TYPE_ID_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,
+       [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_validate,
+       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_validate,
+       [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_validate,
+       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_validate,
+       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_validate,
+       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_validate,
+       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_validate,
+       [BT_CTF_FIELD_TYPE_ID_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,
+       [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_reset,
+       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_reset,
+       [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_reset,
+       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_reset,
+       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_reset,
+       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_reset,
+       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_reset,
+       [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_reset,
 };
 
 static
 int (* const field_serialize_funcs[])(struct bt_ctf_field *,
                struct bt_ctf_stream_pos *, enum bt_ctf_byte_order) = {
-       [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] =
+       [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_serialize,
+       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_serialize,
+       [BT_CTF_FIELD_TYPE_ID_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,
+       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_serialize,
+       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_serialize,
+       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_serialize,
+       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_serialize,
+       [BT_CTF_FIELD_TYPE_ID_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,
+       [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_copy,
+       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_copy,
+       [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_floating_point_copy,
+       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_copy,
+       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_copy,
+       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_copy,
+       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_copy,
+       [BT_CTF_FIELD_TYPE_ID_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,
+       [BT_CTF_FIELD_TYPE_ID_INTEGER] = generic_field_freeze,
+       [BT_CTF_FIELD_TYPE_ID_FLOAT] = generic_field_freeze,
+       [BT_CTF_FIELD_TYPE_ID_STRING] = generic_field_freeze,
+       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_freeze,
+       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_freeze,
+       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_freeze,
+       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_freeze,
+       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_freeze,
 };
 
 static
-bool (* const field_is_set_funcs[])(struct bt_ctf_field *) = {
-       [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_generic_is_set,
-       [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_is_set,
-       [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_generic_is_set,
-       [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_is_set,
-       [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_is_set,
-       [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_is_set,
-       [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_is_set,
-       [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_generic_is_set,
+bt_bool (* const field_is_set_funcs[])(struct bt_ctf_field *) = {
+       [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_is_set,
+       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_is_set,
+       [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_is_set,
+       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_is_set,
+       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_is_set,
+       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_is_set,
+       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_is_set,
+       [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_generic_is_set,
 };
 
 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 bt_ctf_field_type_id type_id;
        int ret;
 
        if (!type) {
@@ -292,7 +292,7 @@ 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 ||
+       if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN ||
                        type_id >= BT_CTF_NR_TYPE_IDS) {
                goto error;
        }
@@ -343,9 +343,9 @@ end:
        return ret;
 }
 
-enum bt_ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field)
+enum bt_ctf_field_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 bt_ctf_field_type_id ret = BT_CTF_FIELD_TYPE_ID_UNKNOWN;
 
        if (!field) {
                goto end;
@@ -358,42 +358,42 @@ end:
 
 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) == BT_CTF_FIELD_TYPE_ID_INTEGER;
 }
 
 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) == BT_CTF_FIELD_TYPE_ID_FLOAT;
 }
 
 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) == BT_CTF_FIELD_TYPE_ID_ENUM;
 }
 
 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) == BT_CTF_FIELD_TYPE_ID_STRING;
 }
 
 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) == BT_CTF_FIELD_TYPE_ID_STRUCT;
 }
 
 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) == BT_CTF_FIELD_TYPE_ID_ARRAY;
 }
 
 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) == BT_CTF_FIELD_TYPE_ID_SEQUENCE;
 }
 
 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) == BT_CTF_FIELD_TYPE_ID_VARIANT;
 }
 
 struct bt_ctf_field *bt_ctf_field_sequence_get_length(
@@ -407,7 +407,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) {
+               BT_CTF_FIELD_TYPE_ID_SEQUENCE) {
                goto end;
        }
 
@@ -432,7 +432,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) {
+               BT_CTF_FIELD_TYPE_ID_INTEGER) {
                ret = -1;
                goto end;
        }
@@ -469,7 +469,7 @@ end:
        return ret;
 }
 
-struct bt_ctf_field *bt_ctf_field_structure_get_field(
+struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name(
                struct bt_ctf_field *field, const char *name)
 {
        struct bt_ctf_field *new_field = NULL;
@@ -480,7 +480,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) {
+                       BT_CTF_FIELD_TYPE_ID_STRUCT) {
                goto error;
        }
 
@@ -520,7 +520,7 @@ error:
 }
 
 struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index(
-               struct bt_ctf_field *field, int index)
+               struct bt_ctf_field *field, uint64_t index)
 {
        int ret;
        const char *field_name;
@@ -531,7 +531,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) {
+               BT_CTF_FIELD_TYPE_ID_STRUCT) {
                goto end;
        }
 
@@ -576,7 +576,6 @@ error:
        return ret_field;
 }
 
-BT_HIDDEN
 int bt_ctf_field_structure_set_field(struct bt_ctf_field *field,
                const char *name, struct bt_ctf_field *value)
 {
@@ -588,7 +587,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) {
+                       BT_CTF_FIELD_TYPE_ID_STRUCT) {
                ret = -1;
                goto end;
        }
@@ -630,7 +629,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) {
+               BT_CTF_FIELD_TYPE_ID_ARRAY) {
                goto end;
        }
 
@@ -670,12 +669,12 @@ 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) {
+               BT_CTF_FIELD_TYPE_ID_SEQUENCE) {
                goto end;
        }
 
        sequence = container_of(field, struct bt_ctf_field_sequence, parent);
-       if (!sequence->elements || sequence->elements->len <= index) {
+       if (!sequence->elements || index >= sequence->elements->len) {
                goto end;
        }
 
@@ -715,9 +714,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 ||
+                       BT_CTF_FIELD_TYPE_ID_VARIANT ||
                bt_ctf_field_type_get_type_id(tag_field->type) !=
-                       BT_CTF_TYPE_ID_ENUM) {
+                       BT_CTF_FIELD_TYPE_ID_ENUM) {
                goto end;
        }
 
@@ -798,7 +797,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) {
+                       BT_CTF_FIELD_TYPE_ID_VARIANT) {
                goto end;
        }
 
@@ -823,7 +822,7 @@ struct bt_ctf_field *bt_ctf_field_variant_get_tag(
 
        if (!variant_field ||
                        bt_ctf_field_type_get_type_id(variant_field->type) !=
-                       BT_CTF_TYPE_ID_VARIANT) {
+                       BT_CTF_FIELD_TYPE_ID_VARIANT) {
                goto end;
        }
 
@@ -843,7 +842,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) {
+               BT_CTF_FIELD_TYPE_ID_ENUM) {
                goto end;
        }
 
@@ -929,7 +928,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) {
+                       BT_CTF_FIELD_TYPE_ID_INTEGER) {
                ret = -1;
                goto end;
        }
@@ -959,7 +958,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) {
+                       BT_CTF_FIELD_TYPE_ID_INTEGER) {
                ret = -1;
                goto end;
        }
@@ -995,7 +994,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) {
+                       BT_CTF_FIELD_TYPE_ID_INTEGER) {
                ret = -1;
                goto end;
        }
@@ -1025,7 +1024,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) {
+                       BT_CTF_FIELD_TYPE_ID_INTEGER) {
                ret = -1;
                goto end;
        }
@@ -1059,7 +1058,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) {
+                       BT_CTF_FIELD_TYPE_ID_FLOAT) {
                ret = -1;
                goto end;
        }
@@ -1079,7 +1078,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) {
+                       BT_CTF_FIELD_TYPE_ID_FLOAT) {
                ret = -1;
                goto end;
        }
@@ -1098,7 +1097,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) {
+                       BT_CTF_FIELD_TYPE_ID_STRING) {
                goto end;
        }
 
@@ -1117,7 +1116,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) {
+                       BT_CTF_FIELD_TYPE_ID_STRING) {
                ret = -1;
                goto end;
        }
@@ -1142,7 +1141,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) {
+                       BT_CTF_FIELD_TYPE_ID_STRING) {
                ret = -1;
                goto end;
        }
@@ -1171,7 +1170,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) {
+                       BT_CTF_FIELD_TYPE_ID_STRING) {
                ret = -1;
                goto end;
        }
@@ -1204,7 +1203,7 @@ BT_HIDDEN
 int bt_ctf_field_validate(struct bt_ctf_field *field)
 {
        int ret = 0;
-       enum bt_ctf_type_id type_id;
+       enum bt_ctf_field_type_id type_id;
 
        if (!field) {
                ret = -1;
@@ -1212,7 +1211,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 <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
                ret = -1;
                goto end;
        }
@@ -1226,7 +1225,7 @@ BT_HIDDEN
 int bt_ctf_field_reset(struct bt_ctf_field *field)
 {
        int ret = 0;
-       enum bt_ctf_type_id type_id;
+       enum bt_ctf_field_type_id type_id;
 
        if (!field) {
                ret = -1;
@@ -1234,7 +1233,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 <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
                ret = -1;
                goto end;
        }
@@ -1250,7 +1249,7 @@ int bt_ctf_field_serialize(struct bt_ctf_field *field,
                enum bt_ctf_byte_order native_byte_order)
 {
        int ret = 0;
-       enum bt_ctf_type_id type_id;
+       enum bt_ctf_field_type_id type_id;
 
        if (!field || !pos) {
                ret = -1;
@@ -1258,7 +1257,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 <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
                ret = -1;
                goto end;
        }
@@ -1270,17 +1269,17 @@ end:
 
 
 BT_HIDDEN
-bool bt_ctf_field_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_is_set(struct bt_ctf_field *field)
 {
-       bool is_set = false;
-       enum bt_ctf_type_id type_id;
+       bt_bool is_set = BT_FALSE;
+       enum bt_ctf_field_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 <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
                goto end;
        }
 
@@ -1293,14 +1292,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 bt_ctf_field_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 <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
                goto end;
        }
 
@@ -1429,12 +1428,12 @@ 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 bt_ctf_field_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 ||
+       if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN ||
                type_id >= BT_CTF_NR_TYPE_IDS) {
                return;
        }
@@ -2406,14 +2405,14 @@ 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 bt_ctf_field_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 ||
+       if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN ||
                        type_id >= BT_CTF_NR_TYPE_IDS) {
                goto end;
        }
@@ -2424,15 +2423,15 @@ end:
 }
 
 static
-bool bt_ctf_field_generic_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_generic_is_set(struct bt_ctf_field *field)
 {
        return field && field->payload_set;
 }
 
 static
-bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *field)
 {
-       bool is_set = false;
+       bt_bool is_set = BT_FALSE;
        struct bt_ctf_field_enumeration *enumeration;
 
        if (!field) {
@@ -2451,9 +2450,9 @@ end:
 }
 
 static
-bool bt_ctf_field_structure_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_structure_is_set(struct bt_ctf_field *field)
 {
-       bool is_set = false;
+       bt_bool is_set = BT_FALSE;
        size_t i;
        struct bt_ctf_field_structure *structure;
 
@@ -2473,9 +2472,9 @@ end:
 }
 
 static
-bool bt_ctf_field_variant_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_variant_is_set(struct bt_ctf_field *field)
 {
-       bool is_set = false;
+       bt_bool is_set = BT_FALSE;
        struct bt_ctf_field_variant *variant;
 
        if (!field) {
@@ -2489,10 +2488,10 @@ end:
 }
 
 static
-bool bt_ctf_field_array_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_array_is_set(struct bt_ctf_field *field)
 {
        size_t i;
-       bool is_set = false;
+       bt_bool is_set = BT_FALSE;
        struct bt_ctf_field_array *array;
 
        if (!field) {
@@ -2511,10 +2510,10 @@ end:
 }
 
 static
-bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *field)
 {
        size_t i;
-       bool is_set = false;
+       bt_bool is_set = BT_FALSE;
        struct bt_ctf_field_sequence *sequence;
 
        if (!field) {
This page took 0.040946 seconds and 4 git commands to generate.