From: Adam Dickmeiss Date: Wed, 14 Sep 2011 11:05:32 +0000 (+0200) Subject: Override id in icu_chain for relevance, sort, .. X-Git-Tag: v1.6.1~4 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=ecc2d7d3b2289501b5b28e4d34299b54934b733f;p=pazpar2-moved-to-github.git Override id in icu_chain for relevance, sort, .. Ignore the id attribute for the obsolete rules in relevance, sort, mergekey, facet. --- 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; }