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

Function xmlXPathDifference

ThirdParty/libxml2/vtklibxml2/xpath.c:3509–3536  ·  view source on GitHub ↗

* xmlXPathDifference: * @nodes1: a node-set * @nodes2: a node-set * * Implements the EXSLT - Sets difference() function: * node-set set:difference (node-set, node-set) * * Returns the difference between the two node sets, or nodes1 if * nodes2 is empty */

Source from the content-addressed store, hash-verified

3507 * nodes2 is empty
3508 */
3509xmlNodeSetPtr
3510xmlXPathDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
3511 xmlNodeSetPtr ret;
3512 int i, l1;
3513 xmlNodePtr cur;
3514
3515 if (xmlXPathNodeSetIsEmpty(nodes2))
3516 return(nodes1);
3517
3518 ret = xmlXPathNodeSetCreate(NULL);
3519 if (ret == NULL)
3520 return(NULL);
3521 if (xmlXPathNodeSetIsEmpty(nodes1))
3522 return(ret);
3523
3524 l1 = xmlXPathNodeSetGetLength(nodes1);
3525
3526 for (i = 0; i < l1; i++) {
3527 cur = xmlXPathNodeSetItem(nodes1, i);
3528 if (!xmlXPathNodeSetContains(nodes2, cur)) {
3529 if (xmlXPathNodeSetAddUnique(ret, cur) < 0) {
3530 xmlXPathFreeNodeSet(ret);
3531 return(NULL);
3532 }
3533 }
3534 }
3535 return(ret);
3536}
3537
3538/**
3539 * xmlXPathIntersection:

Callers

nothing calls this directly

Calls 4

xmlXPathNodeSetCreateFunction · 0.85
xmlXPathNodeSetContainsFunction · 0.85
xmlXPathNodeSetAddUniqueFunction · 0.85
xmlXPathFreeNodeSetFunction · 0.85

Tested by

no test coverage detected