Implement bt_ctf_field_type_variant_set_tag_name()
[babeltrace.git] / formats / ctf / ir / event-types.c
index a4dca127eb0c7c0b39280f3e2984cb4dd3928e52..11ca0e9e0b44bf57e359c92d034a8a73aa66112a 100644 (file)
@@ -1334,6 +1334,25 @@ end:
        return tag_name;
 }
 
+int bt_ctf_field_type_variant_set_tag_name(
+               struct bt_ctf_field_type *type, const char *name)
+{
+       int ret = 0;
+       struct bt_ctf_field_type_variant *variant;
+
+       if (!type || type->frozen ||
+               (type->declaration->id != CTF_TYPE_VARIANT) ||
+               bt_ctf_validate_identifier(name)) {
+               ret = -1;
+               goto end;
+       }
+
+       variant = container_of(type, struct bt_ctf_field_type_variant, parent);
+       g_string_assign(variant->tag_name, name);
+end:
+       return ret;
+}
+
 int bt_ctf_field_type_variant_add_field(struct bt_ctf_field_type *type,
                struct bt_ctf_field_type *field_type,
                const char *field_name)
This page took 0.024403 seconds and 4 git commands to generate.