Added functions to add, remove and move substructs.
[gedcom-parse.git] / gom / family_link.c
index cb266b209d25e03621cc217549140f457720ded2..4ea3fc1c1bd1911504a671a15dbfacaf8668be0b 100644 (file)
@@ -84,6 +84,10 @@ Gedcom_ctxt sub_fam_link_pedi_start(_ELT_PARAMS_)
 }
 
 DEFINE_SUB_MAKEFUNC(family_link)
+DEFINE_SUB_ADDFUNC(family_link)
+DEFINE_SUB_FINDFUNC(family_link)
+DEFINE_SUB_REMOVEFUNC(family_link)
+DEFINE_SUB_MOVEFUNC(family_link)
      
 DEFINE_ADDFUNC2(family_link, note_sub, note)
 DEFINE_ADDFUNC2(family_link, user_data, extra)
@@ -98,6 +102,16 @@ void family_link_subscribe()
                              def_elt_end);
 }
 
+void UNREFALLFUNC(pedigree)(struct pedigree* obj)
+{
+  if (obj) {
+    struct pedigree* runner;
+    for (runner = obj; runner; runner = runner->next) {
+      UNREFALLFUNC(user_data)(runner->extra);
+    }
+  }
+}
+
 void CLEANFUNC(pedigree)(struct pedigree* ped)
 {
   if (ped) {
@@ -105,6 +119,25 @@ void CLEANFUNC(pedigree)(struct pedigree* ped)
   }
 }
 
+DEFINE_SUB_MAKEFUNC(pedigree)
+DEFINE_SUB_ADDFUNC(pedigree)
+DEFINE_SUB_FINDFUNC(pedigree)
+DEFINE_SUB_REMOVEFUNC(pedigree)
+DEFINE_SUB_MOVEFUNC(pedigree)
+     
+void UNREFALLFUNC(family_link)(struct family_link* obj)
+{
+  if (obj) {
+    struct family_link* runner;
+    for (runner = obj; runner; runner = runner->next) {
+      unref_xref_value(runner->family);
+      UNREFALLFUNC(pedigree)(runner->pedigree);
+      UNREFALLFUNC(note_sub)(runner->note);
+      UNREFALLFUNC(user_data)(runner->extra);
+    }
+  }
+}
+
 void CLEANFUNC(family_link)(struct family_link *link)
 {
   if (link) {