From 89ff39aaedee4aa65dec40032686e8b2f8ca272a Mon Sep 17 00:00:00 2001 From: Peter Verthez Date: Sat, 28 Dec 2002 17:01:37 +0000 Subject: [PATCH] A little simplification in the write interface. --- gedcom/write.c | 15 ++------------- gom/family.c | 3 +-- gom/header.c | 5 ++--- gom/individual.c | 3 +-- gom/multimedia.c | 3 +-- gom/note.c | 3 +-- gom/repository.c | 3 +-- gom/source.c | 3 +-- gom/submission.c | 2 +- gom/submitter.c | 3 +-- include/gedcom.h.in | 14 +++++--------- 11 files changed, 17 insertions(+), 40 deletions(-) diff --git a/gedcom/write.c b/gedcom/write.c index e338b94..5bc9efa 100644 --- a/gedcom/write.c +++ b/gedcom/write.c @@ -380,12 +380,11 @@ int _gedcom_write_val(Gedcom_write_hndl hndl, } int gedcom_write_record_str(Gedcom_write_hndl hndl, - Gedcom_rec rec, int tag, - char* xrefstr, char* val) + Gedcom_rec rec, char* xrefstr, char* val) { int result = 1; if (check_type(rec, (val ? GV_CHAR_PTR : GV_NULL))) - result = _gedcom_write_val(hndl, rec, tag, -1, xrefstr, convert_at(val)); + result = _gedcom_write_val(hndl, rec, 0, -1, xrefstr, convert_at(val)); return result; } @@ -400,16 +399,6 @@ int gedcom_write_element_str(Gedcom_write_hndl hndl, return result; } -int gedcom_write_record_xref(Gedcom_write_hndl hndl, - Gedcom_rec rec, int tag, - char* xrefstr, struct xref_value* val) -{ - int result = 1; - if (check_type(rec, (val ? GV_XREF_PTR : GV_NULL))) - result = _gedcom_write_val(hndl, rec, tag, -1, xrefstr, val->string); - return result; -} - int gedcom_write_element_xref(Gedcom_write_hndl hndl, Gedcom_elt elt, int tag, int parent_rec_or_elt, struct xref_value* val) diff --git a/gom/family.c b/gom/family.c index 995fd58..f997eb8 100644 --- a/gom/family.c +++ b/gom/family.c @@ -169,8 +169,7 @@ int write_families(Gedcom_write_hndl hndl) struct family* obj; for (obj = gom_first_family; obj; obj = obj->next) { - result |= gedcom_write_record_str(hndl, REC_FAM, 0, - obj->xrefstr, NULL); + result |= gedcom_write_record_str(hndl, REC_FAM, obj->xrefstr, NULL); if (obj->event) result |= write_events(hndl, REC_FAM, EVT_TYPE_FAMILY, obj->event); if (obj->husband) diff --git a/gom/header.c b/gom/header.c index 448059a..18dc38c 100644 --- a/gom/header.c +++ b/gom/header.c @@ -168,10 +168,9 @@ int write_header(Gedcom_write_hndl hndl) int result = 0; int i; - result |= gedcom_write_record_str(hndl, REC_HEAD, 0, NULL, NULL); + result |= gedcom_write_record_str(hndl, REC_HEAD, NULL, NULL); if (gom_header.charset.name) - result |= gedcom_write_element_str(hndl, ELT_HEAD_CHAR, 0, - REC_HEAD, + result |= gedcom_write_element_str(hndl, ELT_HEAD_CHAR, 0, REC_HEAD, gom_header.charset.name); if (gom_header.charset.version) result |= gedcom_write_element_str(hndl, ELT_HEAD_CHAR_VERS, 0, diff --git a/gom/individual.c b/gom/individual.c index 958cce8..6e8c3fc 100644 --- a/gom/individual.c +++ b/gom/individual.c @@ -230,8 +230,7 @@ int write_individuals(Gedcom_write_hndl hndl) struct individual* obj; for (obj = gom_first_individual; obj; obj = obj->next) { - result |= gedcom_write_record_str(hndl, REC_INDI, 0, - obj->xrefstr, NULL); + result |= gedcom_write_record_str(hndl, REC_INDI, obj->xrefstr, NULL); if (obj->restriction_notice) result |= gedcom_write_element_str(hndl, ELT_INDI_RESN, 0, REC_INDI, obj->restriction_notice); diff --git a/gom/multimedia.c b/gom/multimedia.c index af97afc..5fb331c 100644 --- a/gom/multimedia.c +++ b/gom/multimedia.c @@ -145,8 +145,7 @@ int write_multimedia_recs(Gedcom_write_hndl hndl) struct multimedia* obj; for (obj = gom_first_multimedia; obj; obj = obj->next) { - result |= gedcom_write_record_str(hndl, REC_OBJE, 0, - obj->xrefstr, NULL); + result |= gedcom_write_record_str(hndl, REC_OBJE, obj->xrefstr, NULL); if (obj->form) result |= gedcom_write_element_str(hndl, ELT_OBJE_FORM, 0, REC_OBJE, obj->form); diff --git a/gom/note.c b/gom/note.c index 0dd2443..7f74a30 100644 --- a/gom/note.c +++ b/gom/note.c @@ -151,8 +151,7 @@ int write_notes(Gedcom_write_hndl hndl) struct note* obj; for (obj = gom_first_note; obj; obj = obj->next) { - result |= gedcom_write_record_str(hndl, REC_NOTE, 0, - obj->xrefstr, obj->text); + result |= gedcom_write_record_str(hndl, REC_NOTE, obj->xrefstr, obj->text); if (obj->citation) result |= write_citations(hndl, REC_NOTE, obj->citation); if (obj->ref) diff --git a/gom/repository.c b/gom/repository.c index 1cf4595..3df7388 100644 --- a/gom/repository.c +++ b/gom/repository.c @@ -147,8 +147,7 @@ int write_repositories(Gedcom_write_hndl hndl) struct repository* obj; for (obj = gom_first_repository; obj; obj = obj->next) { - result |= gedcom_write_record_str(hndl, REC_REPO, 0, - obj->xrefstr, NULL); + result |= gedcom_write_record_str(hndl, REC_REPO, obj->xrefstr, NULL); if (obj->name) result |= gedcom_write_element_str(hndl, ELT_REPO_NAME, 0, REC_REPO, obj->name); diff --git a/gom/source.c b/gom/source.c index 2f35397..024fa23 100644 --- a/gom/source.c +++ b/gom/source.c @@ -190,8 +190,7 @@ int write_sources(Gedcom_write_hndl hndl) struct source* obj; for (obj = gom_first_source; obj; obj = obj->next) { - result |= gedcom_write_record_str(hndl, REC_SOUR, 0, - obj->xrefstr, NULL); + result |= gedcom_write_record_str(hndl, REC_SOUR, obj->xrefstr, NULL); if (obj->data.event || obj->data.agency || obj->data.note) result |= gedcom_write_element_str(hndl, ELT_SOUR_DATA, 0, REC_SOUR, NULL); diff --git a/gom/submission.c b/gom/submission.c index 3fe9b40..32b57b8 100644 --- a/gom/submission.c +++ b/gom/submission.c @@ -101,7 +101,7 @@ int write_submission(Gedcom_write_hndl hndl) int result = 0; if (gom_submission) { - result |= gedcom_write_record_str(hndl, REC_SUBN, 0, + result |= gedcom_write_record_str(hndl, REC_SUBN, gom_submission->xrefstr, NULL); if (gom_submission->submitter) result |= gedcom_write_element_xref(hndl, ELT_SUBN_SUBM, 0, diff --git a/gom/submitter.c b/gom/submitter.c index 107653f..44ec48f 100644 --- a/gom/submitter.c +++ b/gom/submitter.c @@ -169,8 +169,7 @@ int write_submitters(Gedcom_write_hndl hndl) struct submitter* obj; for (obj = gom_first_submitter; obj; obj = obj->next) { - result |= gedcom_write_record_str(hndl, REC_SUBM, 0, - obj->xrefstr, NULL); + result |= gedcom_write_record_str(hndl, REC_SUBM, obj->xrefstr, NULL); if (obj->name) result |= gedcom_write_element_str(hndl, ELT_SUBM_NAME, 0, REC_SUBM, obj->name); diff --git a/include/gedcom.h.in b/include/gedcom.h.in index 89160f1..348baef 100644 --- a/include/gedcom.h.in +++ b/include/gedcom.h.in @@ -545,15 +545,11 @@ int gedcom_write_set_encoding(const char* charset, Encoding width, int gedcom_write_set_line_terminator(Enc_line_end end); int gedcom_write_record_str(Gedcom_write_hndl hndl, - Gedcom_rec rec, int parsed_tag, - char* xrefstr, char* val); -int gedcom_write_element_str(Gedcom_write_hndl hndl, Gedcom_elt elt, - int parsed_tag, int parent_rec_or_elt, - char* val); - -int gedcom_write_record_xref(Gedcom_write_hndl hndl, - Gedcom_rec rec, int parsed_tag, - char* xrefstr, struct xref_value* val); + Gedcom_rec rec, char* xrefstr, char* val); + +int gedcom_write_element_str(Gedcom_write_hndl hndl, Gedcom_elt elt, + int parsed_tag, int parent_rec_or_elt, + char* val); int gedcom_write_element_xref(Gedcom_write_hndl hndl, Gedcom_elt elt, int parsed_tag, int parent_rec_or_elt, struct xref_value* val); -- 2.30.2