Improved context handling, to allow elements out of context.
[gedcom-parse.git] / gom / source_citation.c
index 3738636fc086c90e207d17209ac0c118e39df7e7..406972a7b57a5df92eceee4765bb2e44fe8b2f7f 100644 (file)
@@ -49,10 +49,11 @@ Gedcom_ctxt sub_citation_start(_ELT_PARAMS_)
   else {
     struct source_citation *cit = SUB_MAKEFUNC(source_citation)();
     if (cit) {
+      int type = ctxt_type(ctxt);
       if (GEDCOM_IS_XREF_PTR(parsed_value))
        cit->reference = GEDCOM_XREF_PTR(parsed_value);
 
-      switch (ctxt->ctxt_type) {
+      switch (type) {
        case ELT_SUB_PLAC:
          ADDFUNC2(place,source_citation)(ctxt, cit); break;
        case ELT_SUB_FAM_EVT:
@@ -81,7 +82,7 @@ Gedcom_ctxt sub_citation_start(_ELT_PARAMS_)
        case REC_NOTE:
          ADDFUNC2(note,source_citation)(ctxt, cit); break;
        default:
-         UNEXPECTED_CONTEXT(ctxt->ctxt_type);
+         UNEXPECTED_CONTEXT(type);
       }
       result = MAKE_GOM_CTXT(elt, source_citation, cit);
     }
@@ -108,7 +109,7 @@ void sub_citation_end(_ELT_END_PARAMS_)
          cit->description = newvalue;
       }
     }
-    destroy_gom_ctxt(ctxt);
+    def_elt_end(elt, parent, self, parsed_value);
   }
 }