X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gom%2Fplace.c;h=38ff377481d2330b1caef10a37bceac70addb1b4;hb=35764d508082ff9223b631da8959e1494d05e60a;hp=8ceb152b94c6fcfc89aed9cee9a7710feba8f1d5;hpb=72689522e287ca3b2231e7d8881f0fe5bea48f15;p=gedcom-parse.git diff --git a/gom/place.c b/gom/place.c index 8ceb152..38ff377 100644 --- a/gom/place.c +++ b/gom/place.c @@ -41,11 +41,8 @@ Gedcom_ctxt sub_place_start(_ELT_PARAMS_) if (! ctxt) NO_CONTEXT; else { - struct place *place = (struct place *)malloc(sizeof(struct place)); - if (! place) - MEMORY_ERROR; - else { - memset (place, 0, sizeof(struct place)); + struct place *place = SUB_MAKEFUNC(place)(); + if (place) { place->value = strdup(GEDCOM_STRING(parsed_value)); if (!place->value) { @@ -74,6 +71,10 @@ Gedcom_ctxt sub_place_start(_ELT_PARAMS_) return (Gedcom_ctxt)result; } +DEFINE_SUB_MAKEFUNC(place) +DEFINE_SUB_SETFUNC(place) +DEFINE_SUB_DELETEFUNC(place) + DEFINE_STRING_CB(place, sub_place_form_start, place_hierarchy) DEFINE_ADDFUNC2(place, source_citation, citation) @@ -87,6 +88,15 @@ void place_subscribe() sub_place_form_start, def_elt_end); } +void UNREFALLFUNC(place)(struct place* obj) +{ + if (obj) { + UNREFALLFUNC(source_citation)(obj->citation); + UNREFALLFUNC(note_sub)(obj->note); + UNREFALLFUNC(user_data)(obj->extra); + } +} + void CLEANFUNC(place)(struct place* place) { if (place) {