X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fir%2Ffield-types.c;fp=formats%2Fctf%2Fir%2Ffield-types.c;h=043df078464f5eb41d3bcec5b4f367c42b4546d7;hp=49144162d49c9c25372a8e0963279453319cd61a;hb=e0f15669bbfe5c29244ba6e0eb9f1e81f26e5244;hpb=e25dc75977dad34abd4340bd5478f9f3864a6ffd diff --git a/formats/ctf/ir/field-types.c b/formats/ctf/ir/field-types.c index 49144162..043df078 100644 --- a/formats/ctf/ir/field-types.c +++ b/formats/ctf/ir/field-types.c @@ -1879,22 +1879,30 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag( struct bt_ctf_field_type *type, struct bt_ctf_field *tag) { + int ret; const char *enum_value; struct bt_ctf_field_type *field_type = NULL; + struct bt_ctf_field_type_enumeration_mapping_iterator *iter = NULL; if (!type || !tag || type->declaration->id != BT_CTF_TYPE_ID_VARIANT) { goto end; } - enum_value = bt_ctf_field_enumeration_get_single_mapping_name(tag); - if (!enum_value) { + iter = bt_ctf_field_enumeration_get_mappings(tag); + if (!iter) { + goto end; + } + + ret = bt_ctf_field_type_enumeration_mapping_iterator_get_name(iter, + &enum_value); + if (ret) { goto end; } - /* Already increments field_type's reference count */ field_type = bt_ctf_field_type_variant_get_field_type_by_name( type, enum_value); end: + bt_put(iter); return field_type; }