-void individual_add_association(Gom_ctxt ctxt, struct association* assoc)
-{
- struct individual *indiv = SAFE_CTXT_CAST(individual, ctxt);
- LINK_CHAIN_ELT(association, indiv->association, assoc)
-}
-
-void individual_add_citation(Gom_ctxt ctxt, struct source_citation* cit)
-{
- struct individual *indiv = SAFE_CTXT_CAST(individual, ctxt);
- LINK_CHAIN_ELT(source_citation, indiv->citation, cit)
-}
-
-void individual_add_mm_link(Gom_ctxt ctxt, struct multimedia_link* link)
-{
- struct individual *indiv = SAFE_CTXT_CAST(individual, ctxt);
- LINK_CHAIN_ELT(multimedia_link, indiv->mm_link, link)
-}
-
-void individual_add_note(Gom_ctxt ctxt, struct note_sub* note)
-{
- struct individual *indiv = SAFE_CTXT_CAST(individual, ctxt);
- LINK_CHAIN_ELT(note_sub, indiv->note, note)
-}
-
-void individual_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref)
-{
- struct individual *indiv = SAFE_CTXT_CAST(individual, ctxt);
- LINK_CHAIN_ELT(user_ref_number, indiv->ref, ref)
-}
-
-void individual_set_record_id(Gom_ctxt ctxt, char *rin)
-{
- struct individual *indiv = SAFE_CTXT_CAST(individual, ctxt);
- indiv->record_id = strdup(rin);
-}
-
-void individual_set_change_date(Gom_ctxt ctxt, struct change_date* chan)
-{
- struct individual *indiv = SAFE_CTXT_CAST(individual, ctxt);
- indiv->change_date = chan;
-}
-
-void individual_add_user_data(Gom_ctxt ctxt, struct user_data* data)
-{
- struct individual *obj = SAFE_CTXT_CAST(individual, ctxt);
- LINK_CHAIN_ELT(user_data, obj->extra, data)
-}
-
-void individual_cleanup(struct individual* indiv)
-{
- SAFE_FREE(indiv->xrefstr);
- SAFE_FREE(indiv->restriction_notice);
- DESTROY_CHAIN_ELTS(personal_name, indiv->name, name_cleanup)
- SAFE_FREE(indiv->sex);
- DESTROY_CHAIN_ELTS(event, indiv->event, event_cleanup)
- DESTROY_CHAIN_ELTS(event, indiv->attribute, event_cleanup)
- DESTROY_CHAIN_ELTS(lds_event, indiv->lds_individual_ordinance,
- lds_event_cleanup)
- DESTROY_CHAIN_ELTS(family_link, indiv->child_to_family, family_link_cleanup)
- DESTROY_CHAIN_ELTS(family_link, indiv->spouse_to_family, family_link_cleanup)
- DESTROY_CHAIN_ELTS(xref_list, indiv->submitters, NULL_DESTROY)
- DESTROY_CHAIN_ELTS(association, indiv->association, association_cleanup)
- DESTROY_CHAIN_ELTS(xref_list, indiv->alias, NULL_DESTROY)
- DESTROY_CHAIN_ELTS(xref_list, indiv->ancestor_interest, NULL_DESTROY)
- DESTROY_CHAIN_ELTS(xref_list, indiv->descendant_interest, NULL_DESTROY)
- DESTROY_CHAIN_ELTS(source_citation, indiv->citation, citation_cleanup)
- DESTROY_CHAIN_ELTS(multimedia_link, indiv->mm_link, multimedia_link_cleanup)
- DESTROY_CHAIN_ELTS(note_sub, indiv->note, note_sub_cleanup)
- SAFE_FREE(indiv->record_file_nr);
- SAFE_FREE(indiv->ancestral_file_nr);
- DESTROY_CHAIN_ELTS(user_ref_number, indiv->ref, user_ref_cleanup)
- SAFE_FREE(indiv->record_id);
- change_date_cleanup(indiv->change_date);
- DESTROY_CHAIN_ELTS(user_data, indiv->extra, user_data_cleanup)
+void CLEANFUNC(individual)(struct individual* indiv)
+{
+ if (indiv) {
+ SAFE_FREE(indiv->xrefstr);
+ SAFE_FREE(indiv->restriction_notice);
+ DESTROY_CHAIN_ELTS(personal_name, indiv->name);
+ SAFE_FREE(indiv->sex);
+ DESTROY_CHAIN_ELTS(event, indiv->event);
+ DESTROY_CHAIN_ELTS(event, indiv->attribute);
+ DESTROY_CHAIN_ELTS(lds_event, indiv->lds_individual_ordinance);
+ DESTROY_CHAIN_ELTS(family_link, indiv->child_to_family);
+ DESTROY_CHAIN_ELTS(family_link, indiv->spouse_to_family);
+ DESTROY_CHAIN_ELTS(xref_list, indiv->submitters);
+ DESTROY_CHAIN_ELTS(association, indiv->association);
+ DESTROY_CHAIN_ELTS(xref_list, indiv->alias);
+ DESTROY_CHAIN_ELTS(xref_list, indiv->ancestor_interest);
+ DESTROY_CHAIN_ELTS(xref_list, indiv->descendant_interest);
+ DESTROY_CHAIN_ELTS(source_citation, indiv->citation);
+ DESTROY_CHAIN_ELTS(multimedia_link, indiv->mm_link);
+ DESTROY_CHAIN_ELTS(note_sub, indiv->note);
+ SAFE_FREE(indiv->record_file_nr);
+ SAFE_FREE(indiv->ancestral_file_nr);
+ DESTROY_CHAIN_ELTS(user_ref_number, indiv->ref);
+ SAFE_FREE(indiv->record_id);
+ CLEANFUNC(change_date)(indiv->change_date);
+ DESTROY_CHAIN_ELTS(user_data, indiv->extra);
+ }