X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Ftext%2Fprint.c;h=3e920a02ca54a9bc3e78085c8183d3c09617e7af;hb=e0f15669bbfe5c29244ba6e0eb9f1e81f26e5244;hp=5ba979588d9381231bb6b0d2c20827faa3991547;hpb=96e8f959f3f895366c26f945c418a006e6ea397c;p=babeltrace.git diff --git a/plugins/text/print.c b/plugins/text/print.c index 5ba97958..3e920a02 100644 --- a/plugins/text/print.c +++ b/plugins/text/print.c @@ -1010,22 +1010,36 @@ enum bt_component_status print_variant(struct text_component *text, fprintf(text->out, "{ "); text->depth++; if (print_names) { + int iter_ret; struct bt_ctf_field *tag_field = NULL; const char *tag_choice; + struct bt_ctf_field_type_enumeration_mapping_iterator *iter; tag_field = bt_ctf_field_variant_get_tag(variant); if (!tag_field) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - tag_choice = bt_ctf_field_enumeration_get_single_mapping_name(tag_field); - if (!tag_choice) { + + iter = bt_ctf_field_enumeration_get_mappings(tag_field); + if (!iter) { + bt_put(tag_field); + ret = BT_COMPONENT_STATUS_ERROR; + goto end; + } + + iter_ret = + bt_ctf_field_type_enumeration_mapping_iterator_get_name( + iter, &tag_choice); + if (iter_ret) { + bt_put(iter); bt_put(tag_field); ret = BT_COMPONENT_STATUS_ERROR; goto end; } fprintf(text->out, "%s = ", rem_(tag_choice)); bt_put(tag_field); + bt_put(iter); } ret = print_field(text, field, print_names); if (ret != BT_COMPONENT_STATUS_OK) {