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);