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

Function xmlXPathIntersection

ThirdParty/libxml2/vtklibxml2/xpath.c:3549–3574  ·  view source on GitHub ↗

* xmlXPathIntersection: * @nodes1: a node-set * @nodes2: a node-set * * Implements the EXSLT - Sets intersection() function: * node-set set:intersection (node-set, node-set) * * Returns a node set comprising the nodes that are within both the * node sets passed as arguments */

Source from the content-addressed store, hash-verified

3547 * node sets passed as arguments
3548 */
3549xmlNodeSetPtr
3550xmlXPathIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
3551 xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
3552 int i, l1;
3553 xmlNodePtr cur;
3554
3555 if (ret == NULL)
3556 return(ret);
3557 if (xmlXPathNodeSetIsEmpty(nodes1))
3558 return(ret);
3559 if (xmlXPathNodeSetIsEmpty(nodes2))
3560 return(ret);
3561
3562 l1 = xmlXPathNodeSetGetLength(nodes1);
3563
3564 for (i = 0; i < l1; i++) {
3565 cur = xmlXPathNodeSetItem(nodes1, i);
3566 if (xmlXPathNodeSetContains(nodes2, cur)) {
3567 if (xmlXPathNodeSetAddUnique(ret, cur) < 0) {
3568 xmlXPathFreeNodeSet(ret);
3569 return(NULL);
3570 }
3571 }
3572 }
3573 return(ret);
3574}
3575
3576/**
3577 * xmlXPathDistinctSorted:

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