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

Function xmlXPathNodeTrailingSorted

ThirdParty/libxml2/vtklibxml2/xpath.c:3794–3822  ·  view source on GitHub ↗

* xmlXPathNodeTrailingSorted: * @nodes: a node-set, sorted by document order * @node: a node * * Implements the EXSLT - Sets trailing() function: * node-set set:trailing (node-set, node-set) * * Returns the nodes in @nodes that follow @node in document order, * @nodes if @node is NULL or an empty node-set if @nodes * doesn't contain @node */

Source from the content-addressed store, hash-verified

3792 * doesn't contain @node
3793 */
3794xmlNodeSetPtr
3795xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
3796 int i, l;
3797 xmlNodePtr cur;
3798 xmlNodeSetPtr ret;
3799
3800 if (node == NULL)
3801 return(nodes);
3802
3803 ret = xmlXPathNodeSetCreate(NULL);
3804 if (ret == NULL)
3805 return(ret);
3806 if (xmlXPathNodeSetIsEmpty(nodes) ||
3807 (!xmlXPathNodeSetContains(nodes, node)))
3808 return(ret);
3809
3810 l = xmlXPathNodeSetGetLength(nodes);
3811 for (i = l - 1; i >= 0; i--) {
3812 cur = xmlXPathNodeSetItem(nodes, i);
3813 if (cur == node)
3814 break;
3815 if (xmlXPathNodeSetAddUnique(ret, cur) < 0) {
3816 xmlXPathFreeNodeSet(ret);
3817 return(NULL);
3818 }
3819 }
3820 xmlXPathNodeSetSort(ret); /* bug 413451 */
3821 return(ret);
3822}
3823
3824/**
3825 * xmlXPathNodeTrailing:

Callers 3

xmlXPathNodeTrailingFunction · 0.85
xmlXPathTrailingSortedFunction · 0.85
xmlXPathTrailingFunction · 0.85

Calls 5

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

Tested by

no test coverage detected