* xmlXPathNodeSetDel: * @cur: the initial node set * @val: an xmlNodePtr * * Removes an xmlNodePtr from an existing NodeSet */
| 3242 | * Removes an xmlNodePtr from an existing NodeSet |
| 3243 | */ |
| 3244 | void |
| 3245 | xmlXPathNodeSetDel(xmlNodeSetPtr cur, xmlNodePtr val) { |
| 3246 | int i; |
| 3247 | |
| 3248 | if (cur == NULL) return; |
| 3249 | if (val == NULL) return; |
| 3250 | |
| 3251 | /* |
| 3252 | * find node in nodeTab |
| 3253 | */ |
| 3254 | for (i = 0;i < cur->nodeNr;i++) |
| 3255 | if (cur->nodeTab[i] == val) break; |
| 3256 | |
| 3257 | if (i >= cur->nodeNr) { /* not found */ |
| 3258 | return; |
| 3259 | } |
| 3260 | if ((cur->nodeTab[i] != NULL) && |
| 3261 | (cur->nodeTab[i]->type == XML_NAMESPACE_DECL)) |
| 3262 | xmlXPathNodeSetFreeNs((xmlNsPtr) cur->nodeTab[i]); |
| 3263 | cur->nodeNr--; |
| 3264 | for (;i < cur->nodeNr;i++) |
| 3265 | cur->nodeTab[i] = cur->nodeTab[i + 1]; |
| 3266 | cur->nodeTab[cur->nodeNr] = NULL; |
| 3267 | } |
| 3268 | |
| 3269 | /** |
| 3270 | * xmlXPathNodeSetRemove: |
nothing calls this directly
no test coverage detected