X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gom%2Fsource_description.c;h=71bd9e816db3a73c3357748ce8eb520f3345d2ca;hb=f197c791489f1537db4aebc7ce29b6d4f9adc2b3;hp=34ca5216f79f08f838cc3a106d7b0760cce4b519;hpb=72689522e287ca3b2231e7d8881f0fe5bea48f15;p=gedcom-parse.git diff --git a/gom/source_description.c b/gom/source_description.c index 34ca521..71bd9e8 100644 --- a/gom/source_description.c +++ b/gom/source_description.c @@ -38,12 +38,8 @@ Gedcom_ctxt sub_sour_caln_start(_ELT_PARAMS_) if (! ctxt) NO_CONTEXT; else { - struct source_description *desc - = (struct source_description *)malloc(sizeof(struct source_description)); - if (! desc) - MEMORY_ERROR; - else { - memset (desc, 0, sizeof(struct source_description)); + struct source_description *desc = SUB_MAKEFUNC(source_description)(); + if (desc) { desc->call_number = strdup(GEDCOM_STRING(parsed_value)); if (! desc->call_number) { @@ -65,6 +61,8 @@ Gedcom_ctxt sub_sour_caln_start(_ELT_PARAMS_) return (Gedcom_ctxt)result; } +DEFINE_SUB_MAKEFUNC(source_description) + DEFINE_STRING_CB(source_description, sub_sour_caln_medi_start, media) DEFINE_ADDFUNC2(source_description, user_data, extra) @@ -77,6 +75,16 @@ void source_description_subscribe() sub_sour_caln_medi_start, def_elt_end); } +void UNREFALLFUNC(source_description)(struct source_description* obj) +{ + if (obj) { + struct source_description* runner; + for (runner = obj; runner; runner = runner->next) { + UNREFALLFUNC(user_data)(runner->extra); + } + } +} + void CLEANFUNC(source_description)(struct source_description* desc) { if (desc) {