From 4812fa1c41136d288ed9b3de6e171f1982fe8a2e Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 28 Apr 2018 21:25:26 +0200 Subject: [PATCH] unnecessary xpath searches. 1. item does not have functions. 2. resourcelimit is gone. --- src/xmlreader.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/xmlreader.c b/src/xmlreader.c index 66b04e611..333e891df 100644 --- a/src/xmlreader.c +++ b/src/xmlreader.c @@ -696,7 +696,6 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype) item_type *itype = NULL; unsigned int flags = ITF_NONE; xmlXPathObjectPtr result; - int k; if (xml_bvalue(node, "cursed", false)) flags |= ITF_CURSED; @@ -769,27 +768,8 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype) } xmlXPathFreeObject(result); - /* reading item/function */ - xpath->node = node; - result = xmlXPathEvalExpression(BAD_CAST "function", xpath); - for (k = 0; k != result->nodesetval->nodeNr; ++k) { - xmlNodePtr node = result->nodesetval->nodeTab[k]; - xmlChar *propValue; - pf_generic fun; - - parse_function(node, &fun, &propValue); - if (fun == NULL) { - log_error("unknown function name '%s' for item '%s'\n", (const char *)propValue, rtype->_name); - xmlFree(propValue); - continue; - } - assert(propValue != NULL); - log_error("unknown function type '%s' for item '%s'\n", (const char *)propValue, rtype->_name); - xmlFree(propValue); - } itype->score = xml_ivalue(node, "score", 0); if (!itype->score) itype->score = default_score(itype); - xmlXPathFreeObject(result); return itype; } @@ -869,10 +849,6 @@ static int parse_resources(xmlDocPtr doc) result = xmlXPathEvalExpression(BAD_CAST "modifier", xpath); rtype->modifiers = xml_readmodifiers(result, node); xmlXPathFreeObject(result); - /* reading eressea/resources/resource/resourcelimit/function */ - xpath->node = node; - result = xmlXPathEvalExpression(BAD_CAST "resourcelimit/function", xpath); - xmlXPathFreeObject(result); /* reading eressea/resources/resource/item */ xpath->node = node;