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
Correct sub_note_end callback: parsed value can be NULL.
[gedcom-parse.git]
/
gom
/
source_description.c
diff --git
a/gom/source_description.c
b/gom/source_description.c
index 34ca5216f79f08f838cc3a106d7b0760cce4b519..71bd9e816db3a73c3357748ce8eb520f3345d2ca 100644
(file)
--- 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 {
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) {
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;
}
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)
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);
}
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) {
void CLEANFUNC(source_description)(struct source_description* desc)
{
if (desc) {