X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fir%2Fevent-types.c;h=61c0404d998d30f01f281a8e8c5d387a46eb97bd;hp=91104860483220924f34880caa195803d26ce2b8;hb=626e93aa41c9a6b3f70538aad04a20df07b36b73;hpb=c436d7875012915ab7f18250297561a39fac59d2 diff --git a/formats/ctf/ir/event-types.c b/formats/ctf/ir/event-types.c index 91104860..61c0404d 100644 --- a/formats/ctf/ir/event-types.c +++ b/formats/ctf/ir/event-types.c @@ -1545,6 +1545,32 @@ end: return ret; } +BT_HIDDEN +int bt_ctf_field_type_array_set_element_type(struct bt_ctf_field_type *type, + struct bt_ctf_field_type *element_type) +{ + int ret = 0; + struct bt_ctf_field_type_array *array; + + if (!type || !element_type || + (type->declaration->id != CTF_TYPE_ARRAY)) { + ret = -1; + goto end; + } + + array = container_of(type, struct bt_ctf_field_type_array, parent); + + if (array->element_type) { + BT_PUT(array->element_type); + } + + array->element_type = element_type; + bt_get(array->element_type); + +end: + return ret; +} + int64_t bt_ctf_field_type_array_get_length(struct bt_ctf_field_type *type) { int64_t ret; @@ -1606,6 +1632,32 @@ end: return ret; } +BT_HIDDEN +int bt_ctf_field_type_sequence_set_element_type(struct bt_ctf_field_type *type, + struct bt_ctf_field_type *element_type) +{ + int ret = 0; + struct bt_ctf_field_type_sequence *sequence; + + if (!type || !element_type || + (type->declaration->id != CTF_TYPE_SEQUENCE)) { + ret = -1; + goto end; + } + + sequence = container_of(type, struct bt_ctf_field_type_sequence, parent); + + if (sequence->element_type) { + BT_PUT(sequence->element_type); + } + + sequence->element_type = element_type; + bt_get(sequence->element_type); + +end: + return ret; +} + const char *bt_ctf_field_type_sequence_get_length_field_name( struct bt_ctf_field_type *type) {