X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=types%2Fvariant.c;h=ea20808b7205f1e31ea1fee4dce603e5584359bf;hp=3c2244be88bc8c934e123d63ba5785d351a9ad24;hb=05628561ca57ff5d269571a72a12cb86854c5f70;hpb=ac88af7594050b366fadec583e60ac26bb2aff75 diff --git a/types/variant.c b/types/variant.c index 3c2244be..ea20808b 100644 --- a/types/variant.c +++ b/types/variant.c @@ -54,6 +54,7 @@ void _variant_type_free(struct type *type) container_of(type, struct type_variant, p); unsigned long i; + free_type_scope(variant_type->scope); g_hash_table_destroy(variant_type->fields_by_tag); for (i = 0; i < variant_type->fields->len; i++) { @@ -66,7 +67,8 @@ void _variant_type_free(struct type *type) g_free(variant_type); } -struct type_variant *variant_type_new(const char *name) +struct type_variant *variant_type_new(const char *name, + struct type_scope *parent_scope) { struct type_variant *variant_type; struct type *type; @@ -78,6 +80,8 @@ struct type_variant *variant_type_new(const char *name) variant_type->fields = g_array_sized_new(FALSE, TRUE, sizeof(struct type_field), DEFAULT_NR_STRUCT_FIELDS); + variant_type->scope = new_type_scope(parent_scope); + type->id = CTF_TYPE_VARIANT; type->name = g_quark_from_string(name); type->alignment = 1; type->copy = variant_copy;