From: Peter Verthez Date: Sun, 15 Sep 2002 19:02:13 +0000 (+0000) Subject: Taking care of const correctness. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=4c445928c8f7d30731a66522ffb9747fe13a3243;p=gedcom-parse.git Taking care of const correctness. --- diff --git a/gom/family.c b/gom/family.c index 066753b..83ad0b1 100644 --- a/gom/family.c +++ b/gom/family.c @@ -100,7 +100,7 @@ void family_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref) LINK_CHAIN_ELT(user_ref_number, fam->ref, ref); } -void family_set_record_id(Gom_ctxt ctxt, char *rin) +void family_set_record_id(Gom_ctxt ctxt, const char *rin) { struct family *fam = SAFE_CTXT_CAST(family, ctxt); if (fam) { @@ -152,7 +152,7 @@ struct family* gom_get_first_family() return gom_first_family; } -struct family* make_family_record(char* xrefstr) +struct family* make_family_record(const char* xrefstr) { struct family* fam = NULL; MAKE_CHAIN_ELT(family, gom_first_family, fam); diff --git a/gom/family.h b/gom/family.h index 3e218b4..6193892 100644 --- a/gom/family.h +++ b/gom/family.h @@ -29,14 +29,14 @@ void family_subscribe(); void families_cleanup(); -struct family* make_family_record(char* xref); +struct family* make_family_record(const char* xref); void family_add_event(Gom_ctxt ctxt, struct event* evt); void family_add_lss(Gom_ctxt ctxt, struct lds_event* lss); void family_add_citation(Gom_ctxt ctxt, struct source_citation* cit); void family_add_mm_link(Gom_ctxt ctxt, struct multimedia_link* link); void family_add_note(Gom_ctxt ctxt, struct note_sub* note); void family_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref); -void family_set_record_id(Gom_ctxt ctxt, char *rin); +void family_set_record_id(Gom_ctxt ctxt, const char *rin); void family_set_change_date(Gom_ctxt ctxt, struct change_date* chan); void family_add_user_data(Gom_ctxt ctxt, struct user_data* data); diff --git a/gom/gom.c b/gom/gom.c index 025541d..0203fc6 100644 --- a/gom/gom.c +++ b/gom/gom.c @@ -69,7 +69,7 @@ void gom_cleanup() user_recs_cleanup(); } -int gom_parse_file(char* file_name) +int gom_parse_file(const char* file_name) { gedcom_set_default_callback(gom_default_callback); header_subscribe(); @@ -126,7 +126,8 @@ void destroy_gom_ctxt(Gom_ctxt ctxt) SAFE_FREE(ctxt); } -void gom_cast_error(char* file, int line, OBJ_TYPE expected, OBJ_TYPE found) +void gom_cast_error(const char* file, int line, + OBJ_TYPE expected, OBJ_TYPE found) { fprintf(stderr, "Wrong gom ctxt cast at %s, line %d: expected %d, found %d\n", @@ -134,25 +135,25 @@ void gom_cast_error(char* file, int line, OBJ_TYPE expected, OBJ_TYPE found) abort(); } -void gom_mem_error(char *filename, int line) +void gom_mem_error(const char *filename, int line) { gedcom_error(_("Could not allocate memory at %s, %d"), filename, line); } -void gom_unexpected_context(char* file, int line, OBJ_TYPE found) +void gom_unexpected_context(const char* file, int line, OBJ_TYPE found) { gedcom_warning(_("Internal error: Unexpected context at %s, line %d: %d"), file, line, found); } -void gom_no_context(char* file, int line) +void gom_no_context(const char* file, int line) { gedcom_warning(_("Internal error: No context at %s, line %d"), file, line); } -void gom_default_callback (Gedcom_elt elt, Gedcom_ctxt parent, int level, char* tag, - char* raw_value, int parsed_tag) +void gom_default_callback (Gedcom_elt elt, Gedcom_ctxt parent, int level, + char* tag, char* raw_value, int parsed_tag) { gedcom_warning(_("Data loss in import: \"%d %s %s\""), level, tag, raw_value); @@ -171,7 +172,7 @@ void def_elt_end(Gedcom_elt elt, Gedcom_ctxt parent, Gedcom_ctxt self, destroy_gom_ctxt(ctxt); } -void set_xref_type(struct xref_value* xr, char *str) +void set_xref_type(struct xref_value* xr, const char *str) { if (!strcasecmp(str, "FAM")) xr->type = XREF_FAM; @@ -241,3 +242,24 @@ struct age_value* dup_age(struct age_value age) } return age_ptr; } + +char* gom_get_string(char** data) +{ + return *data; +} + +char* gom_set_string(char** data, char* newvalue) +{ + char* result = NULL; + char* newptr = strdup(newvalue); + + if (!newptr) + MEMORY_ERROR; + else { + if (*data) free(*data); + *data = newptr; + result = *data; + } + + return result; +} diff --git a/gom/gom_internal.h b/gom/gom_internal.h index 6950b60..d1b7706 100644 --- a/gom/gom_internal.h +++ b/gom/gom_internal.h @@ -64,9 +64,10 @@ typedef struct Gom_ctxt_struct *Gom_ctxt; Gom_ctxt make_gom_ctxt(int ctxt_type, OBJ_TYPE obj_type, void *ctxt_ptr); void destroy_gom_ctxt(Gom_ctxt ctxt); -void gom_cast_error(char* file, int line, OBJ_TYPE expected, OBJ_TYPE found); -void gom_no_context(char* file, int line); -void gom_unexpected_context(char* file, int line, OBJ_TYPE found); +void gom_cast_error(const char* file, int line, + OBJ_TYPE expected, OBJ_TYPE found); +void gom_no_context(const char* file, int line); +void gom_unexpected_context(const char* file, int line, OBJ_TYPE found); #define MAKE_GOM_CTXT(CTXT_TYPE, STRUCTTYPE, CTXT_PTR) \ make_gom_ctxt(CTXT_TYPE, T_ ## STRUCTTYPE, CTXT_PTR) @@ -89,14 +90,14 @@ void gom_unexpected_context(char* file, int line, OBJ_TYPE found); #define NO_CONTEXT \ gom_no_context(__FILE__, __LINE__) -void gom_mem_error(char *filename, int line); +void gom_mem_error(const char *filename, int line); #define MEMORY_ERROR gom_mem_error(__FILE__, __LINE__) void def_rec_end(Gedcom_rec rec, Gedcom_ctxt self); void def_elt_end(Gedcom_elt elt, Gedcom_ctxt parent, Gedcom_ctxt self, Gedcom_val parsed_value); -void set_xref_type(struct xref_value *xr, char* str); +void set_xref_type(struct xref_value *xr, const char* str); typedef enum { WITHOUT_NL, @@ -170,7 +171,7 @@ void NULL_DESTROY(void* anything); } #define GET_REC_BY_XREF(STRUCTTYPE,XREF_TYPE,FUNC_NAME) \ - struct STRUCTTYPE *FUNC_NAME(char *xrefstr) \ + struct STRUCTTYPE *FUNC_NAME(const char *xrefstr) \ { \ struct xref_value* xr = gedcom_get_by_xref(xrefstr); \ if (xr && (xr->type == XREF_TYPE) && xr->object) \ diff --git a/gom/header.c b/gom/header.c index 1422ae2..f9032d8 100644 --- a/gom/header.c +++ b/gom/header.c @@ -69,7 +69,7 @@ void header_add_address(Gom_ctxt ctxt, struct address* addr) head->source.corporation.address = addr; } -void header_add_phone(Gom_ctxt ctxt, char* phone) +void header_add_phone(Gom_ctxt ctxt, const char* phone) { struct header *head = SAFE_CTXT_CAST(header, ctxt); if (head) { @@ -83,7 +83,7 @@ void header_add_phone(Gom_ctxt ctxt, char* phone) } } -void header_add_to_note(NL_TYPE type, Gom_ctxt ctxt, char* str) +void header_add_to_note(NL_TYPE type, Gom_ctxt ctxt, const char* str) { struct header *head = SAFE_CTXT_CAST(header, ctxt); if (head) { diff --git a/gom/header.h b/gom/header.h index 3caf8c0..7882a2b 100644 --- a/gom/header.h +++ b/gom/header.h @@ -30,8 +30,8 @@ void header_subscribe(); void header_cleanup(); void header_add_address(Gom_ctxt header, struct address* addr); -void header_add_phone (Gom_ctxt header, char* phone); -void header_add_to_note(NL_TYPE type, Gom_ctxt header, char* str); +void header_add_phone (Gom_ctxt header, const char* phone); +void header_add_to_note(NL_TYPE type, Gom_ctxt header, const char* str); void header_add_user_data(Gom_ctxt ctxt, struct user_data* data); #endif /* __HEADER_H */ diff --git a/gom/individual.c b/gom/individual.c index 4c7e860..07e69b1 100644 --- a/gom/individual.c +++ b/gom/individual.c @@ -149,7 +149,7 @@ void individual_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref) LINK_CHAIN_ELT(user_ref_number, indiv->ref, ref); } -void individual_set_record_id(Gom_ctxt ctxt, char *rin) +void individual_set_record_id(Gom_ctxt ctxt, const char *rin) { struct individual *indiv = SAFE_CTXT_CAST(individual, ctxt); if (indiv) { @@ -213,7 +213,7 @@ struct individual* gom_get_first_individual() return gom_first_individual; } -struct individual* make_individual_record(char* xrefstr) +struct individual* make_individual_record(const char* xrefstr) { struct individual* indiv = NULL; MAKE_CHAIN_ELT(individual, gom_first_individual, indiv); diff --git a/gom/individual.h b/gom/individual.h index 9e17527..f9bad23 100644 --- a/gom/individual.h +++ b/gom/individual.h @@ -29,7 +29,7 @@ void individual_subscribe(); void individuals_cleanup(); -struct individual* make_individual_record(char* xref); +struct individual* make_individual_record(const char* xref); void individual_add_event(Gom_ctxt ctxt, struct event* evt); void individual_add_attribute(Gom_ctxt ctxt, struct event* evt); void individual_add_name(Gom_ctxt ctxt, struct personal_name* name); @@ -41,7 +41,7 @@ void individual_add_citation(Gom_ctxt ctxt, struct source_citation* cit); void individual_add_mm_link(Gom_ctxt ctxt, struct multimedia_link* link); void individual_add_note(Gom_ctxt ctxt, struct note_sub* note); void individual_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref); -void individual_set_record_id(Gom_ctxt ctxt, char *rin); +void individual_set_record_id(Gom_ctxt ctxt, const char *rin); void individual_set_change_date(Gom_ctxt ctxt, struct change_date* chan); void individual_add_user_data(Gom_ctxt ctxt, struct user_data* data); diff --git a/gom/multimedia.c b/gom/multimedia.c index 4faaf1f..8013292 100644 --- a/gom/multimedia.c +++ b/gom/multimedia.c @@ -100,7 +100,7 @@ void multimedia_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref) LINK_CHAIN_ELT(user_ref_number, obj->ref, ref); } -void multimedia_set_record_id(Gom_ctxt ctxt, char *rin) +void multimedia_set_record_id(Gom_ctxt ctxt, const char *rin) { struct multimedia *obj = SAFE_CTXT_CAST(multimedia, ctxt); if (obj) { @@ -148,7 +148,7 @@ struct multimedia* gom_get_first_multimedia() return gom_first_multimedia; } -struct multimedia* make_multimedia_record(char* xrefstr) +struct multimedia* make_multimedia_record(const char* xrefstr) { struct multimedia* multi = NULL; MAKE_CHAIN_ELT(multimedia, gom_first_multimedia, multi); diff --git a/gom/multimedia.h b/gom/multimedia.h index 5284126..855eda3 100644 --- a/gom/multimedia.h +++ b/gom/multimedia.h @@ -29,10 +29,10 @@ void multimedia_subscribe(); void multimedias_cleanup(); -struct multimedia* make_multimedia_record(char* xref); +struct multimedia* make_multimedia_record(const char* xref); void multimedia_add_note(Gom_ctxt ctxt, struct note_sub* note); void multimedia_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref); -void multimedia_set_record_id(Gom_ctxt ctxt, char *rin); +void multimedia_set_record_id(Gom_ctxt ctxt, const char *rin); void multimedia_set_change_date(Gom_ctxt ctxt, struct change_date* chan); void multimedia_add_user_data(Gom_ctxt ctxt, struct user_data* data); diff --git a/gom/note.c b/gom/note.c index 4443da2..c6fb9e3 100644 --- a/gom/note.c +++ b/gom/note.c @@ -99,7 +99,7 @@ void note_subscribe() gedcom_subscribe_to_element(ELT_SUB_CONC, sub_cont_conc_start, def_elt_end); } -void note_add_to_note(NL_TYPE type, Gom_ctxt ctxt, char* str) +void note_add_to_note(NL_TYPE type, Gom_ctxt ctxt, const char* str) { struct note *note = SAFE_CTXT_CAST(note, ctxt); if (note) { @@ -125,7 +125,7 @@ void note_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref) LINK_CHAIN_ELT(user_ref_number, note->ref, ref); } -void note_set_record_id(Gom_ctxt ctxt, char *rin) +void note_set_record_id(Gom_ctxt ctxt, const char *rin) { struct note *note = SAFE_CTXT_CAST(note, ctxt); if (note) { @@ -171,7 +171,7 @@ struct note* gom_get_first_note() return gom_first_note; } -struct note* make_note_record(char* xrefstr) +struct note* make_note_record(const char* xrefstr) { struct note* note = NULL; MAKE_CHAIN_ELT(note, gom_first_note, note); diff --git a/gom/note.h b/gom/note.h index b47b3b0..4f5f9cd 100644 --- a/gom/note.h +++ b/gom/note.h @@ -29,11 +29,11 @@ void note_subscribe(); void notes_cleanup(); -struct note* make_note_record(char* xref); -void note_add_to_note(NL_TYPE type, Gom_ctxt ctxt, char* str); +struct note* make_note_record(const char* xref); +void note_add_to_note(NL_TYPE type, Gom_ctxt ctxt, const char* str); void note_add_citation(Gom_ctxt ctxt, struct source_citation* cit); void note_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref); -void note_set_record_id(Gom_ctxt ctxt, char *rin); +void note_set_record_id(Gom_ctxt ctxt, const char *rin); void note_set_change_date(Gom_ctxt ctxt, struct change_date* chan); void note_add_user_data(Gom_ctxt ctxt, struct user_data* data); diff --git a/gom/note_sub.c b/gom/note_sub.c index 008b9d0..bdfb1e6 100644 --- a/gom/note_sub.c +++ b/gom/note_sub.c @@ -136,7 +136,7 @@ void note_sub_add_citation(Gom_ctxt ctxt, struct source_citation* cit) LINK_CHAIN_ELT(source_citation, note->citation, cit); } -void note_sub_add_to_note(NL_TYPE type, Gom_ctxt ctxt, char* str) +void note_sub_add_to_note(NL_TYPE type, Gom_ctxt ctxt, const char* str) { struct note_sub *note = SAFE_CTXT_CAST(note_sub, ctxt); if (note) { diff --git a/gom/note_sub.h b/gom/note_sub.h index 8368d52..f014d45 100644 --- a/gom/note_sub.h +++ b/gom/note_sub.h @@ -30,7 +30,7 @@ void note_sub_subscribe(); void note_sub_cleanup(struct note_sub* note); void note_sub_add_citation(Gom_ctxt ctxt, struct source_citation* cit); -void note_sub_add_to_note(NL_TYPE type, Gom_ctxt ctxt, char* str); +void note_sub_add_to_note(NL_TYPE type, Gom_ctxt ctxt, const char* str); void note_sub_add_user_data(Gom_ctxt ctxt, struct user_data* data); #endif /* __NOTE_SUB_H */ diff --git a/gom/repository.c b/gom/repository.c index a2f61dd..b34081c 100644 --- a/gom/repository.c +++ b/gom/repository.c @@ -52,7 +52,7 @@ void repository_add_address(Gom_ctxt ctxt, struct address* address) repo->address = address; } -void repository_add_phone(Gom_ctxt ctxt, char *phone) +void repository_add_phone(Gom_ctxt ctxt, const char *phone) { struct repository *repo = SAFE_CTXT_CAST(repository, ctxt); if (repo) { @@ -79,7 +79,7 @@ void repository_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref) LINK_CHAIN_ELT(user_ref_number, repo->ref, ref); } -void repository_set_record_id(Gom_ctxt ctxt, char *rin) +void repository_set_record_id(Gom_ctxt ctxt, const char *rin) { struct repository *repo = SAFE_CTXT_CAST(repository, ctxt); if (repo) { @@ -129,7 +129,7 @@ struct repository* gom_get_first_repository() return gom_first_repository; } -struct repository* make_repository_record(char* xrefstr) +struct repository* make_repository_record(const char* xrefstr) { struct repository* repo = NULL; MAKE_CHAIN_ELT(repository, gom_first_repository, repo); diff --git a/gom/repository.h b/gom/repository.h index cee45fe..ec3c866 100644 --- a/gom/repository.h +++ b/gom/repository.h @@ -29,12 +29,12 @@ void repository_subscribe(); void repositories_cleanup(); -struct repository* make_repository_record(char* xref); +struct repository* make_repository_record(const char* xref); void repository_add_address(Gom_ctxt ctxt, struct address* address); -void repository_add_phone(Gom_ctxt ctxt, char *phone); +void repository_add_phone(Gom_ctxt ctxt, const char *phone); void repository_add_note(Gom_ctxt ctxt, struct note_sub* note); void repository_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref); -void repository_set_record_id(Gom_ctxt ctxt, char *rin); +void repository_set_record_id(Gom_ctxt ctxt, const char *rin); void repository_set_change_date(Gom_ctxt ctxt, struct change_date* chan); void repository_add_user_data(Gom_ctxt ctxt, struct user_data* data); diff --git a/gom/source.c b/gom/source.c index 34a7c9e..edf53ed 100644 --- a/gom/source.c +++ b/gom/source.c @@ -91,7 +91,7 @@ void source_add_description(Gom_ctxt ctxt, struct source_description* desc) LINK_CHAIN_ELT(source_description, sour->repository.description, desc); } -void source_add_to_value(NL_TYPE type, Gom_ctxt ctxt, char* str) +void source_add_to_value(NL_TYPE type, Gom_ctxt ctxt, const char* str) { struct source *sour = SAFE_CTXT_CAST(source, ctxt); if (sour) { @@ -152,7 +152,7 @@ void source_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref) LINK_CHAIN_ELT(user_ref_number, sour->ref, ref); } -void source_set_record_id(Gom_ctxt ctxt, char *rin) +void source_set_record_id(Gom_ctxt ctxt, const char *rin) { struct source *sour = SAFE_CTXT_CAST(source, ctxt); if (sour) { @@ -209,7 +209,7 @@ struct source* gom_get_first_source() return gom_first_source; } -struct source* make_source_record(char* xrefstr) +struct source* make_source_record(const char* xrefstr) { struct source* src = NULL; MAKE_CHAIN_ELT(source, gom_first_source, src); diff --git a/gom/source.h b/gom/source.h index a7e71ab..0846698 100644 --- a/gom/source.h +++ b/gom/source.h @@ -29,16 +29,16 @@ void source_subscribe(); void sources_cleanup(); -struct source* make_source_record(char* xref); +struct source* make_source_record(const char* xref); void source_add_event(Gom_ctxt ctxt, struct source_event* evt); void source_add_note_to_data(Gom_ctxt ctxt, struct note_sub* note); -void source_add_to_value(NL_TYPE type, Gom_ctxt ctxt, char* str); +void source_add_to_value(NL_TYPE type, Gom_ctxt ctxt, const char* str); void source_add_note_to_repo(Gom_ctxt ctxt, struct note_sub* note); void source_add_description(Gom_ctxt ctxt, struct source_description* desc); void source_add_mm_link(Gom_ctxt ctxt, struct multimedia_link* link); void source_add_note(Gom_ctxt ctxt, struct note_sub* note); void source_add_user_ref(Gom_ctxt ctxt, struct user_ref_number* ref); -void source_set_record_id(Gom_ctxt ctxt, char *rin); +void source_set_record_id(Gom_ctxt ctxt, const char *rin); void source_set_change_date(Gom_ctxt ctxt, struct change_date* chan); void source_add_user_data(Gom_ctxt ctxt, struct user_data* data); diff --git a/gom/source_citation.c b/gom/source_citation.c index 0d7fb96..c31e32c 100644 --- a/gom/source_citation.c +++ b/gom/source_citation.c @@ -173,7 +173,7 @@ void citation_add_mm_link(Gom_ctxt ctxt, struct multimedia_link* mm) LINK_CHAIN_ELT(multimedia_link, cit->mm_link, mm); } -void citation_add_to_desc(NL_TYPE type, Gom_ctxt ctxt, char* str) +void citation_add_to_desc(NL_TYPE type, Gom_ctxt ctxt, const char* str) { struct source_citation *cit = SAFE_CTXT_CAST(source_citation, ctxt); if (cit) { @@ -185,7 +185,7 @@ void citation_add_to_desc(NL_TYPE type, Gom_ctxt ctxt, char* str) } } -void citation_add_to_text(NL_TYPE type, Gom_ctxt ctxt, char* str) +void citation_add_to_text(NL_TYPE type, Gom_ctxt ctxt, const char* str) { struct text *t = SAFE_CTXT_CAST(text, ctxt); if (t) { diff --git a/gom/source_citation.h b/gom/source_citation.h index da5f02a..f6765c1 100644 --- a/gom/source_citation.h +++ b/gom/source_citation.h @@ -32,8 +32,8 @@ void citation_subscribe(); void citation_cleanup(struct source_citation* cit); void citation_add_note(Gom_ctxt ctxt, struct note_sub* note); void citation_add_mm_link(Gom_ctxt ctxt, struct multimedia_link* mm); -void citation_add_to_desc(NL_TYPE type, Gom_ctxt ctxt, char* str); -void citation_add_to_text(NL_TYPE type, Gom_ctxt ctxt, char* str); +void citation_add_to_desc(NL_TYPE type, Gom_ctxt ctxt, const char* str); +void citation_add_to_text(NL_TYPE type, Gom_ctxt ctxt, const char* str); void citation_add_user_data(Gom_ctxt ctxt, struct user_data* data); #endif /* __SOURCE_CITATION_H */ diff --git a/gom/submission.c b/gom/submission.c index a72df9a..fcd3c86 100644 --- a/gom/submission.c +++ b/gom/submission.c @@ -80,7 +80,7 @@ struct submission* gom_get_submission() return gom_submission; } -struct submission* make_submission_record(char* xref) +struct submission* make_submission_record(const char* xref) { if (! gom_submission) { gom_submission = (struct submission*)malloc(sizeof(struct submission)); diff --git a/gom/submission.h b/gom/submission.h index 44863d0..0a5d40d 100644 --- a/gom/submission.h +++ b/gom/submission.h @@ -29,7 +29,7 @@ void submission_subscribe(); void submission_cleanup(); -struct submission* make_submission_record(char* xref); +struct submission* make_submission_record(const char* xref); void submission_add_user_data(Gom_ctxt ctxt, struct user_data* data); #endif /* __SUBMISSION_H */ diff --git a/gom/submitter.c b/gom/submitter.c index 39046ab..cbfbcd7 100644 --- a/gom/submitter.c +++ b/gom/submitter.c @@ -87,7 +87,7 @@ void submitter_add_address(Gom_ctxt ctxt, struct address* address) subm->address = address; } -void submitter_add_phone(Gom_ctxt ctxt, char *phone) +void submitter_add_phone(Gom_ctxt ctxt, const char *phone) { struct submitter *subm = SAFE_CTXT_CAST(submitter, ctxt); if (subm) { @@ -151,7 +151,7 @@ struct submitter* gom_get_first_submitter() return gom_first_submitter; } -struct submitter* make_submitter_record(char* xrefstr) +struct submitter* make_submitter_record(const char* xrefstr) { struct submitter* subm = NULL; MAKE_CHAIN_ELT(submitter, gom_first_submitter, subm); diff --git a/gom/submitter.h b/gom/submitter.h index 813c36c..c1e57ff 100644 --- a/gom/submitter.h +++ b/gom/submitter.h @@ -29,9 +29,9 @@ void submitter_subscribe(); void submitters_cleanup(); -struct submitter* make_submitter_record(char* xref); +struct submitter* make_submitter_record(const char* xref); void submitter_add_address(Gom_ctxt ctxt, struct address* address); -void submitter_add_phone(Gom_ctxt ctxt, char *phone); +void submitter_add_phone(Gom_ctxt ctxt, const char *phone); void submitter_add_mm_link(Gom_ctxt ctxt, struct multimedia_link* link); void submitter_set_change_date(Gom_ctxt ctxt, struct change_date* chan); void submitter_add_user_data(Gom_ctxt ctxt, struct user_data* data); diff --git a/gom/user_rec.c b/gom/user_rec.c index 7c05d15..b34e20d 100644 --- a/gom/user_rec.c +++ b/gom/user_rec.c @@ -241,7 +241,7 @@ struct user_rec* gom_get_first_user_rec() return gom_first_user_rec; } -struct user_rec* make_user_record(char* xrefstr) +struct user_rec* make_user_record(const char* xrefstr) { struct user_rec* rec = NULL; MAKE_CHAIN_ELT(user_rec, gom_first_user_rec, rec); diff --git a/gom/user_rec.h b/gom/user_rec.h index 5b54990..2cbeef6 100644 --- a/gom/user_rec.h +++ b/gom/user_rec.h @@ -29,7 +29,7 @@ void user_rec_subscribe(); void user_recs_cleanup(); -struct user_rec* make_user_record(char* xref); +struct user_rec* make_user_record(const char* xref); void user_data_cleanup(struct user_data* data); void user_rec_add_user_data(Gom_ctxt ctxt, struct user_data* data); diff --git a/include/gom.h b/include/gom.h index 766e0da..0af1ee5 100644 --- a/include/gom.h +++ b/include/gom.h @@ -413,34 +413,34 @@ struct user_rec { /* Functions */ -int gom_parse_file(char *file_name); +int gom_parse_file(const char *file_name); struct header* gom_get_header(); struct submission* gom_get_submission(); struct family* gom_get_first_family(); -struct family* gom_get_family_by_xref(char *xref); +struct family* gom_get_family_by_xref(const char *xref); struct individual* gom_get_first_individual(); -struct individual* gom_get_individual_by_xref(char *xref); +struct individual* gom_get_individual_by_xref(const char *xref); struct multimedia* gom_get_first_multimedia(); -struct multimedia* gom_get_multimedia_by_xref(char *xref); +struct multimedia* gom_get_multimedia_by_xref(const char *xref); struct note* gom_get_first_note(); -struct note* gom_get_note_by_xref(char *xref); +struct note* gom_get_note_by_xref(const char *xref); struct repository* gom_get_first_repository(); -struct repository* gom_get_repository_by_xref(char *xref); +struct repository* gom_get_repository_by_xref(const char *xref); struct source* gom_get_first_source(); -struct source* gom_get_source_by_xref(char *xref); +struct source* gom_get_source_by_xref(const char *xref); struct submitter* gom_get_first_submitter(); -struct submitter* gom_get_submitter_by_xref(char *xref); +struct submitter* gom_get_submitter_by_xref(const char *xref); struct user_rec* gom_get_first_user_rec(); -struct user_rec* gom_get_user_rec_by_xref(char *xref); +struct user_rec* gom_get_user_rec_by_xref(const char *xref); __END_DECLS