* xmlXPathPopNodeSet: * @ctxt: an XPath parser context * * Pops a node-set from the stack, handling conversion if needed. * Check error with #xmlXPathCheckError. * * Returns the node-set */
| 2198 | * Returns the node-set |
| 2199 | */ |
| 2200 | xmlNodeSetPtr |
| 2201 | xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt) { |
| 2202 | xmlXPathObjectPtr obj; |
| 2203 | xmlNodeSetPtr ret; |
| 2204 | |
| 2205 | if (ctxt == NULL) return(NULL); |
| 2206 | if (ctxt->value == NULL) { |
| 2207 | xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND); |
| 2208 | return(NULL); |
| 2209 | } |
| 2210 | if (!xmlXPathStackIsNodeSet(ctxt)) { |
| 2211 | xmlXPathSetTypeError(ctxt); |
| 2212 | return(NULL); |
| 2213 | } |
| 2214 | obj = valuePop(ctxt); |
| 2215 | ret = obj->nodesetval; |
| 2216 | #if 0 |
| 2217 | /* to fix memory leak of not clearing obj->user */ |
| 2218 | if (obj->boolval && obj->user != NULL) |
| 2219 | xmlFreeNodeList((xmlNodePtr) obj->user); |
| 2220 | #endif |
| 2221 | obj->nodesetval = NULL; |
| 2222 | xmlXPathReleaseObject(ctxt->context, obj); |
| 2223 | return(ret); |
| 2224 | } |
| 2225 | |
| 2226 | /** |
| 2227 | * xmlXPathPopExternal: |
nothing calls this directly
no test coverage detected