This commit is contained in:
Enno Rehling 2017-02-07 18:23:12 +01:00
commit 9c6a72f55e
1 changed files with 4 additions and 6 deletions

View File

@ -358,16 +358,13 @@ static int parse_calendar(xmlDocPtr doc)
xmlXPathContextPtr xpath = xmlXPathNewContext(doc); xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
xmlXPathObjectPtr xpathCalendars; xmlXPathObjectPtr xpathCalendars;
xmlNodeSetPtr nsetCalendars; xmlNodeSetPtr nsetCalendars;
int c, rv = 0;
/* reading eressea/buildings/building */ /* reading eressea/buildings/building */
xpathCalendars = xmlXPathEvalExpression(BAD_CAST "/eressea/calendar", xpath); xpathCalendars = xmlXPathEvalExpression(BAD_CAST "/eressea/calendar", xpath);
nsetCalendars = xpathCalendars->nodesetval; nsetCalendars = xpathCalendars->nodesetval;
months_per_year = 0; months_per_year = 0;
if (nsetCalendars == NULL || nsetCalendars->nodeNr == 0) { if (nsetCalendars != NULL && nsetCalendars->nodeNr != 0) {
rv = -1; int c;
}
else
for (c = 0; c != nsetCalendars->nodeNr; ++c) { for (c = 0; c != nsetCalendars->nodeNr; ++c) {
xmlNodePtr calendar = nsetCalendars->nodeTab[c]; xmlNodePtr calendar = nsetCalendars->nodeTab[c];
xmlXPathObjectPtr xpathWeeks, xpathMonths, xpathSeasons; xmlXPathObjectPtr xpathWeeks, xpathMonths, xpathSeasons;
@ -477,10 +474,11 @@ static int parse_calendar(xmlDocPtr doc)
xmlFree(newyear); xmlFree(newyear);
newyear = NULL; newyear = NULL;
} }
}
xmlXPathFreeObject(xpathCalendars); xmlXPathFreeObject(xpathCalendars);
xmlXPathFreeContext(xpath); xmlXPathFreeContext(xpath);
return rv; return 0;
} }
static int parse_ships(xmlDocPtr doc) static int parse_ships(xmlDocPtr doc)