+
+register_error:
+ {
+ struct enum_range_to_quark *iter, *tmp;
+
+ cds_list_for_each_entry_safe(iter, tmp, &enum_class->table.range_to_quark, node) {
+ cds_list_del(&iter->node);
+ g_free(iter);
+ }
+ }
+ g_hash_table_destroy(enum_class->table.value_to_quark_set);
+ g_hash_table_destroy(enum_class->table.quark_to_range_set);
+ g_free(enum_class);
+ return NULL;
+}
+
+static
+struct type_enum *_enum_type_new(struct type_class *type_class,
+ struct declaration_scope *parent_scope)
+{
+ struct type_class_enum *enum_class =
+ container_of(type_class, struct type_class_enum, p);
+ struct type_enum *_enum;
+
+ _enum = g_new(struct type_enum, 1);
+ type_class_ref(&enum_class->p);
+ _enum->p._class = enum_class;
+ _enum->p.ref = 1;
+ _enum->value = NULL;
+ return &_enum->p;
+}
+
+static
+void _enum_type_free(struct type *type)
+{
+ struct type_enum *_enum = container_of(type, struct type_enum, p);
+
+ type_class_unref(_enum->p._class);
+ if (_enum->value)
+ g_array_unref(_enum->value, TRUE);
+ g_free(_enum);