dlugolecki.net.pl
Dziennik
Polecane
Software
projects
/
gedcom-parse.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improved context handling, to allow elements out of context.
[gedcom-parse.git]
/
gom
/
place.c
diff --git
a/gom/place.c
b/gom/place.c
index 8ceb152b94c6fcfc89aed9cee9a7710feba8f1d5..779ea87881591a1c558d9fd06df7efe53aeb7840 100644
(file)
--- a/
gom/place.c
+++ b/
gom/place.c
@@
-41,11
+41,8
@@
Gedcom_ctxt sub_place_start(_ELT_PARAMS_)
if (! ctxt)
NO_CONTEXT;
else {
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) {
place->value = strdup(GEDCOM_STRING(parsed_value));
if (!place->value) {
@@
-53,7
+50,8
@@
Gedcom_ctxt sub_place_start(_ELT_PARAMS_)
free(place);
}
else {
free(place);
}
else {
- switch (ctxt->ctxt_type) {
+ int type = ctxt_type(ctxt);
+ switch (type) {
case ELT_SUB_FAM_EVT:
case ELT_SUB_FAM_EVT_EVEN:
case ELT_SUB_INDIV_ATTR:
case ELT_SUB_FAM_EVT:
case ELT_SUB_FAM_EVT_EVEN:
case ELT_SUB_INDIV_ATTR:
@@
-64,7
+62,7
@@
Gedcom_ctxt sub_place_start(_ELT_PARAMS_)
case ELT_SUB_INDIV_EVEN:
ADDFUNC2_NOLIST(event,place)(ctxt, place); break;
default:
case ELT_SUB_INDIV_EVEN:
ADDFUNC2_NOLIST(event,place)(ctxt, place); break;
default:
- UNEXPECTED_CONTEXT(
ctxt->ctxt_
type);
+ UNEXPECTED_CONTEXT(type);
}
result = MAKE_GOM_CTXT(elt, place, place);
}
}
result = MAKE_GOM_CTXT(elt, place, place);
}
@@
-74,6
+72,10
@@
Gedcom_ctxt sub_place_start(_ELT_PARAMS_)
return (Gedcom_ctxt)result;
}
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)
DEFINE_STRING_CB(place, sub_place_form_start, place_hierarchy)
DEFINE_ADDFUNC2(place, source_citation, citation)
@@
-87,6
+89,15
@@
void place_subscribe()
sub_place_form_start, def_elt_end);
}
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) {
void CLEANFUNC(place)(struct place* place)
{
if (place) {