X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gom%2Fsource_citation.c;h=64ad42b4e7bb34ee1331bdc8424185155c4fe2cb;hb=35764d508082ff9223b631da8959e1494d05e60a;hp=8e186cc15d5030c6a36deeae1aa7e39d4f0a3caf;hpb=72689522e287ca3b2231e7d8881f0fe5bea48f15;p=gedcom-parse.git diff --git a/gom/source_citation.c b/gom/source_citation.c index 8e186cc..64ad42b 100644 --- a/gom/source_citation.c +++ b/gom/source_citation.c @@ -47,13 +47,8 @@ Gedcom_ctxt sub_citation_start(_ELT_PARAMS_) if (! ctxt) NO_CONTEXT; else { - struct source_citation *cit - = (struct source_citation *)malloc(sizeof(struct source_citation)); - - if (! cit) - MEMORY_ERROR; - else { - memset (cit, 0, sizeof(struct source_citation)); + struct source_citation *cit = SUB_MAKEFUNC(source_citation)(); + if (cit) { if (GEDCOM_IS_XREF_PTR(parsed_value)) cit->reference = GEDCOM_XREF_PTR(parsed_value); @@ -137,6 +132,8 @@ Gedcom_ctxt sub_cit_text_start(_ELT_PARAMS_) return (Gedcom_ctxt)result; } +DEFINE_SUB_MAKEFUNC(source_citation) + DEFINE_STRING_CB(source_citation, sub_cit_page_start, page) DEFINE_STRING_CB(source_citation, sub_cit_even_start, event) DEFINE_STRING_CB(source_citation, sub_cit_even_role_start, role) @@ -169,6 +166,15 @@ void citation_subscribe() def_elt_end); } +void UNREFALLFUNC(text)(struct text* obj) +{ + if (obj) { + struct text* runner; + for (runner = obj; runner; runner = runner->next) + UNREFALLFUNC(user_data)(runner->extra); + } +} + void CLEANFUNC(text)(struct text* t) { if (t) { @@ -176,6 +182,20 @@ void CLEANFUNC(text)(struct text* t) } } +void UNREFALLFUNC(source_citation)(struct source_citation* obj) +{ + if (obj) { + struct source_citation* runner; + for (runner = obj; runner; runner = runner->next) { + unref_xref_value(runner->reference); + UNREFALLFUNC(text)(runner->text); + UNREFALLFUNC(multimedia_link)(runner->mm_link); + UNREFALLFUNC(note_sub)(runner->note); + UNREFALLFUNC(user_data)(runner->extra); + } + } +} + void CLEANFUNC(source_citation)(struct source_citation* cit) { if (cit) {