assert(node->u.unary_expression.link == UNARY_LINK_UNKNOWN);
assert(i == 0);
src_string = node->u.unary_expression.u.string;
- ret = uuid_parse(node->u.unary_expression.u.string, *uuid);
+ ret = uuid_parse(src_string, *uuid);
}
return ret;
}
fprintf(fd, "[error] %s: unable to find struct field declaration type\n", __func__);
return -EINVAL;
}
+
+ /* Check if field with same name already exists */
+ if (struct_declaration_lookup_field_index(struct_declaration, field_name) >= 0) {
+ fprintf(fd, "[error] %s: duplicate field %s in struct\n", __func__, g_quark_to_string(field_name));
+ return -EINVAL;
+ }
+
struct_declaration_add_field(struct_declaration,
g_quark_to_string(field_name),
field_declaration);
fprintf(fd, "[error] %s: unable to find variant field declaration type\n", __func__);
return -EINVAL;
}
+
+ if (untagged_variant_declaration_get_field_from_tag(untagged_variant_declaration, field_name) != NULL) {
+ fprintf(fd, "[error] %s: duplicate field %s in variant\n", __func__, g_quark_to_string(field_name));
+ return -EINVAL;
+ }
+
+
untagged_variant_declaration_add_field(untagged_variant_declaration,
g_quark_to_string(field_name),
field_declaration);
return 0;
error:
- type_declaration->declaration_free(type_declaration);
+ if (type_declaration) {
+ type_declaration->declaration_free(type_declaration);
+ }
return err;
}
ret = ctf_struct_declaration_list_visit(fd, depth + 1, iter,
struct_declaration, trace);
if (ret)
- goto error;
+ goto error_free_declaration;
}
if (name) {
ret = register_struct_declaration(g_quark_from_string(name),
}
return &struct_declaration->p;
}
-error:
+error_free_declaration:
struct_declaration->p.declaration_free(&struct_declaration->p);
+error:
return NULL;
}
struct ctf_trace *trace)
{
struct ctf_node *expression;
- uint64_t alignment, size;
+ uint64_t alignment = 1, size;
int byte_order = trace->byte_order;
int signedness = 0;
int has_alignment = 0, has_size = 0;
struct ctf_trace *trace)
{
struct ctf_node *expression;
- uint64_t alignment, exp_dig, mant_dig, byte_order = trace->byte_order;
+ uint64_t alignment = 1, exp_dig = 0, mant_dig = 0,
+ byte_order = trace->byte_order;
int has_alignment = 0, has_exp_dig = 0, has_mant_dig = 0;
struct declaration_float *float_declaration;