- struct type_class_float *float_class;
- struct type_class *type_class;
- int ret;
-
- float_class = g_new(struct type_class_float, 1);
- type_class = &float_class->p;
- type_class->name = g_quark_from_string(name);
- type_class->alignment = alignment;
- type_class->copy = float_copy;
- type_class->class_free = _float_type_class_free;
- type_class->type_new = _float_type_new;
- type_class->type_free = _float_type_free;
- type_class->ref = 1;
- float_class->byte_order = byte_order;
-
- float_class->sign = integer_type_new(NULL, 1,
- byte_order, false, 1);
- if (!float_class->mantissa)
- goto error_sign;
- float_class->mantissa = integer_type_new(NULL, mantissa_len - 1,
- byte_order, false, 1);
- if (!float_class->mantissa)
- goto error_mantissa;
- float_class->exp = integer_type_new(NULL, exp_len,
- byte_order, true, 1);
- if (!float_class->exp)
- goto error_exp;
-
- if (float_class->p.name) {
- ret = register_type(&float_class->p);
- if (ret)
- goto error_register;
- }
- return float_class;
-
-error_register:
- type_class_unref(&float_class->exp->p);
-error_exp:
- type_class_unref(&float_class->mantissa->p);
-error_mantissa:
- type_class_unref(&float_class->sign->p);
-error_sign:
- g_free(float_class);
- return NULL;
+ struct declaration_float *float_declaration;
+ struct declaration *declaration;
+
+ float_declaration = g_new(struct declaration_float, 1);
+ declaration = &float_declaration->p;
+ declaration->id = CTF_TYPE_FLOAT;
+ declaration->alignment = alignment;
+ declaration->copy = float_copy;
+ declaration->declaration_free = _float_declaration_free;
+ declaration->definition_new = _float_definition_new;
+ declaration->definition_free = _float_definition_free;
+ declaration->ref = 1;
+ float_declaration->byte_order = byte_order;
+
+ float_declaration->sign = integer_declaration_new(1,
+ byte_order, false, 1);
+ float_declaration->mantissa = integer_declaration_new(mantissa_len - 1,
+ byte_order, false, 1);
+ float_declaration->exp = integer_declaration_new(exp_len,
+ byte_order, true, 1);
+ return float_declaration;