MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlXPathCompareNodeSetFloat

Function xmlXPathCompareNodeSetFloat

ThirdParty/libxml2/vtklibxml2/xpath.c:5451–5484  ·  view source on GitHub ↗

* xmlXPathCompareNodeSetFloat: * @ctxt: the XPath Parser context * @inf: less than (1) or greater than (0) * @strict: is the comparison strict * @arg: the node set * @f: the value * * Implement the compare operation between a nodeset and a number * @ns < @val (1, 1, ... * @ns <= @val (1, 0, ... * @ns > @val (0, 1, ... * @ns >= @val (0, 0, ... * * If one

Source from the content-addressed store, hash-verified

5449 * Returns 0 or 1 depending on the results of the test.
5450 */
5451static int
5452xmlXPathCompareNodeSetFloat(xmlXPathParserContextPtr ctxt, int inf, int strict,
5453 xmlXPathObjectPtr arg, xmlXPathObjectPtr f) {
5454 int i, ret = 0;
5455 xmlNodeSetPtr ns;
5456 xmlChar *str2;
5457
5458 if ((f == NULL) || (arg == NULL) ||
5459 ((arg->type != XPATH_NODESET) && (arg->type != XPATH_XSLT_TREE))) {
5460 xmlXPathReleaseObject(ctxt->context, arg);
5461 xmlXPathReleaseObject(ctxt->context, f);
5462 return(0);
5463 }
5464 ns = arg->nodesetval;
5465 if (ns != NULL) {
5466 for (i = 0;i < ns->nodeNr;i++) {
5467 str2 = xmlXPathCastNodeToString(ns->nodeTab[i]);
5468 if (str2 != NULL) {
5469 valuePush(ctxt, xmlXPathCacheNewString(ctxt, str2));
5470 xmlFree(str2);
5471 xmlXPathNumberFunction(ctxt, 1);
5472 valuePush(ctxt, xmlXPathCacheObjectCopy(ctxt, f));
5473 ret = xmlXPathCompareValues(ctxt, inf, strict);
5474 if (ret)
5475 break;
5476 } else {
5477 xmlXPathPErrMemory(ctxt);
5478 }
5479 }
5480 }
5481 xmlXPathReleaseObject(ctxt->context, arg);
5482 xmlXPathReleaseObject(ctxt->context, f);
5483 return(ret);
5484}
5485
5486/**
5487 * xmlXPathCompareNodeSetString:

Callers 1

Calls 8

xmlXPathReleaseObjectFunction · 0.85
xmlXPathCastNodeToStringFunction · 0.85
valuePushFunction · 0.85
xmlXPathCacheNewStringFunction · 0.85
xmlXPathNumberFunctionFunction · 0.85
xmlXPathCacheObjectCopyFunction · 0.85
xmlXPathCompareValuesFunction · 0.85
xmlXPathPErrMemoryFunction · 0.85

Tested by

no test coverage detected