From 7b470d2685d5a2479cf710b41d19d62e062b0dd6 Mon Sep 17 00:00:00 2001 From: Peter Verthez Date: Sun, 1 Sep 2002 14:10:08 +0000 Subject: [PATCH] Use XREF_ANY when type is not known. Added function gedcom_get_by_xref. --- gedcom/xref.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gedcom/xref.c b/gedcom/xref.c index 1aa3b6c..ee58ad0 100644 --- a/gedcom/xref.c +++ b/gedcom/xref.c @@ -126,6 +126,17 @@ int check_xref_table() return result; } +struct xref_value *gedcom_get_by_xref(char *key) +{ + hnode_t *node = hash_lookup(xrefs, key); + if (node) { + struct xref_node *xr = (struct xref_node *)hnode_get(node); + return &(xr->xref); + } + else + return NULL; +} + struct xref_value *gedcom_parse_xref(char *raw_value, Xref_ctxt ctxt, Xref_type xref_type) { @@ -153,9 +164,11 @@ struct xref_value *gedcom_parse_xref(char *raw_value, xr->used_line = line_no; } - if ((ctxt == XREF_DEFINED && xr->defined_type != xref_type) + if ((ctxt == XREF_DEFINED && xr->defined_type != xref_type && + xr->defined_type != XREF_ANY) || (ctxt == XREF_USED && - (xr->defined_type != XREF_NONE && xr->defined_type != xref_type))) { + (xr->defined_type != XREF_NONE && xr->defined_type != xref_type && + xr->defined_type != XREF_ANY))) { gedcom_error(_("Cross-reference %s previously defined as pointer to %s, " "on line %d"), xr->xref.string, xref_type_str[xr->defined_type], -- 2.30.2