From ecc2d7d3b2289501b5b28e4d34299b54934b733f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 14 Sep 2011 13:05:32 +0200 Subject: [PATCH] Override id in icu_chain for relevance, sort, .. Ignore the id attribute for the obsolete rules in relevance, sort, mergekey, facet. --- src/charsets.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/charsets.c b/src/charsets.c index 0199514..f0f1af0 100644 --- a/src/charsets.c +++ b/src/charsets.c @@ -160,23 +160,26 @@ int pp2_charset_fact_define(pp2_charset_fact_t pft, { int r; pp2_charset_t pct; - xmlChar *id; + xmlChar *id = 0; assert(xml_node); pct = pp2_charset_create_xml(xml_node); if (!pct) return -1; - id = xmlGetProp(xml_node, (xmlChar*) "id"); - if (id) - default_id = (const char *) id; if (!default_id) { - yaz_log(YLOG_WARN, "Missing id for icu_chain"); - pp2_charset_destroy(pct); - return -1; + id = xmlGetProp(xml_node, (xmlChar*) "id"); + if (!id) + { + yaz_log(YLOG_WARN, "Missing id for icu_chain"); + pp2_charset_destroy(pct); + return -1; + } + default_id = (const char *) id; } r = pp2_charset_fact_add(pft, pct, default_id); - xmlFree(id); + if (id) + xmlFree(id); return r; } -- 1.7.10.4