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

Function xmlXPathNodeCollectAndTest

ThirdParty/libxml2/vtklibxml2/xpath.c:10807–11405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10805}
10806
10807static int
10808xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
10809 xmlXPathStepOpPtr op,
10810 xmlNodePtr * first, xmlNodePtr * last,
10811 int toBool)
10812{
10813
10814#define XP_TEST_HIT \
10815 if (hasAxisRange != 0) { \
10816 if (++pos == maxPos) { \
10817 if (addNode(seq, cur) < 0) \
10818 xmlXPathPErrMemory(ctxt); \
10819 goto axis_range_end; } \
10820 } else { \
10821 if (addNode(seq, cur) < 0) \
10822 xmlXPathPErrMemory(ctxt); \
10823 if (breakOnFirstHit) goto first_hit; }
10824
10825#define XP_TEST_HIT_NS \
10826 if (hasAxisRange != 0) { \
10827 if (++pos == maxPos) { \
10828 hasNsNodes = 1; \
10829 if (xmlXPathNodeSetAddNs(seq, xpctxt->node, (xmlNsPtr) cur) < 0) \
10830 xmlXPathPErrMemory(ctxt); \
10831 goto axis_range_end; } \
10832 } else { \
10833 hasNsNodes = 1; \
10834 if (xmlXPathNodeSetAddNs(seq, xpctxt->node, (xmlNsPtr) cur) < 0) \
10835 xmlXPathPErrMemory(ctxt); \
10836 if (breakOnFirstHit) goto first_hit; }
10837
10838 xmlXPathAxisVal axis = (xmlXPathAxisVal) op->value;
10839 xmlXPathTestVal test = (xmlXPathTestVal) op->value2;
10840 xmlXPathTypeVal type = (xmlXPathTypeVal) op->value3;
10841 const xmlChar *prefix = op->value4;
10842 const xmlChar *name = op->value5;
10843 const xmlChar *URI = NULL;
10844
10845 int total = 0, hasNsNodes = 0;
10846 /* The popped object holding the context nodes */
10847 xmlXPathObjectPtr obj;
10848 /* The set of context nodes for the node tests */
10849 xmlNodeSetPtr contextSeq;
10850 int contextIdx;
10851 xmlNodePtr contextNode;
10852 /* The final resulting node set wrt to all context nodes */
10853 xmlNodeSetPtr outSeq;
10854 /*
10855 * The temporary resulting node set wrt 1 context node.
10856 * Used to feed predicate evaluation.
10857 */
10858 xmlNodeSetPtr seq;
10859 xmlNodePtr cur;
10860 /* First predicate operator */
10861 xmlXPathStepOpPtr predOp;
10862 int maxPos; /* The requested position() (when a "[n]" predicate) */
10863 int hasPredicateRange, hasAxisRange, pos;
10864 int breakOnFirstHit;

Callers 4

xmlXPathCompOpEvalFirstFunction · 0.85
xmlXPathCompOpEvalLastFunction · 0.85
xmlXPathCompOpEvalFunction · 0.85

Calls 14

valuePopFunction · 0.85
xmlXPathNsLookupFunction · 0.85
xmlXPathReleaseObjectFunction · 0.85
valuePushFunction · 0.85
xmlXPathNodeSetCreateFunction · 0.85
xmlXPathPErrMemoryFunction · 0.85
xmlXPathCmpNodesExtFunction · 0.85
xmlXPathCmpNodesFunction · 0.85
xmlStrEqualFunction · 0.85
xmlXPathFreeNodeSetFunction · 0.85

Tested by

no test coverage detected