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

Function xmlXPtrGetChildNo

ThirdParty/libxml2/vtklibxml2/xpointer.c:881–903  ·  view source on GitHub ↗

* xmlXPtrGetChildNo: * @ctxt: the XPointer Parser context * @index: the child number * * Move the current node of the nodeset on the stack to the * given child if found */

Source from the content-addressed store, hash-verified

879 * given child if found
880 */
881static void
882xmlXPtrGetChildNo(xmlXPathParserContextPtr ctxt, int indx) {
883 xmlNodePtr cur = NULL;
884 xmlXPathObjectPtr obj;
885 xmlNodeSetPtr oldset;
886
887 CHECK_TYPE(XPATH_NODESET);
888 obj = valuePop(ctxt);
889 oldset = obj->nodesetval;
890 if ((indx <= 0) || (oldset == NULL) || (oldset->nodeNr != 1)) {
891 xmlXPathFreeObject(obj);
892 valuePush(ctxt, xmlXPathNewNodeSet(NULL));
893 return;
894 }
895 cur = xmlXPtrGetNthChild(oldset->nodeTab[0], indx);
896 if (cur == NULL) {
897 xmlXPathFreeObject(obj);
898 valuePush(ctxt, xmlXPathNewNodeSet(NULL));
899 return;
900 }
901 oldset->nodeTab[0] = cur;
902 valuePush(ctxt, obj);
903}
904
905/**
906 * xmlXPtrEvalXPtrPart:

Callers 1

xmlXPtrEvalChildSeqFunction · 0.85

Calls 5

valuePopFunction · 0.85
xmlXPathFreeObjectFunction · 0.85
valuePushFunction · 0.85
xmlXPathNewNodeSetFunction · 0.85
xmlXPtrGetNthChildFunction · 0.85

Tested by

no test coverage detected