* xmlXPtrCmpPoints: * @node1: the first node * @index1: the first index * @node2: the second node * @index2: the second index * * Compare two points w.r.t document order * * Returns -2 in case of error 1 if first point < second point, 0 if * that's the same point, -1 otherwise */
| 220 | * that's the same point, -1 otherwise |
| 221 | */ |
| 222 | static int |
| 223 | xmlXPtrCmpPoints(xmlNodePtr node1, int index1, xmlNodePtr node2, int index2) { |
| 224 | if ((node1 == NULL) || (node2 == NULL)) |
| 225 | return(-2); |
| 226 | /* |
| 227 | * a couple of optimizations which will avoid computations in most cases |
| 228 | */ |
| 229 | if (node1 == node2) { |
| 230 | if (index1 < index2) |
| 231 | return(1); |
| 232 | if (index1 > index2) |
| 233 | return(-1); |
| 234 | return(0); |
| 235 | } |
| 236 | return(xmlXPathCmpNodes(node1, node2)); |
| 237 | } |
| 238 | |
| 239 | /** |
| 240 | * xmlXPtrNewPoint: |
no test coverage detected