-void lds_event_cleanup(struct lds_event* lds)
-{
- if (lds) {
- SAFE_FREE(lds->date_status);
- SAFE_FREE(lds->date);
- SAFE_FREE(lds->temple_code);
- SAFE_FREE(lds->place_living_ordinance);
- DESTROY_CHAIN_ELTS(source_citation, lds->citation, citation_cleanup)
- DESTROY_CHAIN_ELTS(note_sub, lds->note, note_sub_cleanup)
- DESTROY_CHAIN_ELTS(user_data, lds->extra, user_data_cleanup)
+ if (!lds) return 1;
+
+ for (obj = lds; obj; obj = obj->next) {
+ int obj_elt = get_gedcom_elt(obj->event);
+ result |= gedcom_write_element_str(hndl, obj_elt, obj->event,
+ parent, NULL);
+ if (obj->date_status)
+ result |= gedcom_write_element_str(hndl, ELT_SUB_LIO_BAPL_STAT, 0,
+ obj_elt, obj->date_status);
+ if (obj->date)
+ result |= gedcom_write_element_date(hndl, ELT_SUB_LIO_BAPL_DATE, 0,
+ obj_elt, obj->date);
+ if (obj->temple_code)
+ result |= gedcom_write_element_str(hndl, ELT_SUB_LIO_BAPL_TEMP, 0,
+ obj_elt, obj->temple_code);
+ if (obj->place_living_ordinance)
+ result |= gedcom_write_element_str(hndl, ELT_SUB_LIO_BAPL_PLAC, 0,
+ obj_elt, obj->place_living_ordinance);
+ if (obj->family)
+ result |= gedcom_write_element_xref(hndl, ELT_SUB_LIO_SLGC_FAMC, 0,
+ obj_elt, obj->family);
+ if (obj->citation)
+ result |= write_citations(hndl, obj_elt, obj->citation);
+ if (obj->note)
+ result |= write_note_subs(hndl, obj_elt, obj->note);
+ if (obj->extra)
+ result |= write_user_data(hndl, obj->extra);