Customized footer.
[gedcom-parse.git] / gom / change_date.c
index bf51134aa8be06e12b4986ae183394a575340ccb..605039d8d2b28ea7f0f460c0beef51c660ce123a 100644 (file)
@@ -48,7 +48,8 @@ Gedcom_ctxt sub_chan_start(_ELT_PARAMS_)
   else {
     struct change_date *chan = SUB_MAKEFUNC(change_date)();
     if (chan) {
-      switch (ctxt->ctxt_type) {
+      int type = ctxt_type(ctxt);
+      switch (type) {
        case REC_FAM:
          ADDFUNC2_NOLIST(family,change_date)(ctxt, chan); break;
        case REC_INDI:
@@ -64,7 +65,7 @@ Gedcom_ctxt sub_chan_start(_ELT_PARAMS_)
        case REC_SUBM:
          ADDFUNC2_NOLIST(submitter,change_date)(ctxt, chan); break;
        default:
-         UNEXPECTED_CONTEXT(ctxt->ctxt_type);
+         UNEXPECTED_CONTEXT(type);
       }
       result = MAKE_GOM_CTXT(elt, change_date, chan);
     }
@@ -74,7 +75,7 @@ Gedcom_ctxt sub_chan_start(_ELT_PARAMS_)
 }
 
 DEFINE_SUB_MAKEFUNC(change_date)
-DEFINE_SUB_ADDFUNC(change_date)
+DEFINE_SUB_SETFUNC(change_date)
 DEFINE_SUB_DELETEFUNC(change_date)
 
 DEFINE_DATE_CB(change_date, sub_chan_date_start, date)
@@ -92,6 +93,14 @@ void change_date_subscribe()
                              def_elt_end);
 }
 
+void UNREFALLFUNC(change_date)(struct change_date* obj)
+{
+  if (obj) {
+    UNREFALLFUNC(note_sub)(obj->note);
+    UNREFALLFUNC(user_data)(obj->extra);
+  }
+}
+
 void CLEANFUNC(change_date)(struct change_date *chan)
 {
   if (chan) {
@@ -137,7 +146,7 @@ int gom_update_timestamp(struct change_date** chan, time_t t)
 {
   int result = 1;
   if (chan) {
-    if (! *chan) gom_add_change_date(chan);
+    if (! *chan) gom_set_new_change_date(chan);
     if (*chan) {
       struct tm *tm_ptr = localtime(&t);
       result = 0;