* xmlPatternMaxDepth: * @comp: the precompiled pattern * * Check the maximum depth reachable by a pattern * * Returns -2 if no limit (using //), otherwise the depth, * and -1 in case of error */
| 2495 | * and -1 in case of error |
| 2496 | */ |
| 2497 | int |
| 2498 | xmlPatternMaxDepth(xmlPatternPtr comp) { |
| 2499 | int ret = 0, i; |
| 2500 | if (comp == NULL) |
| 2501 | return(-1); |
| 2502 | while (comp != NULL) { |
| 2503 | if (comp->stream == NULL) |
| 2504 | return(-1); |
| 2505 | for (i = 0;i < comp->stream->nbStep;i++) |
| 2506 | if (comp->stream->steps[i].flags & XML_STREAM_STEP_DESC) |
| 2507 | return(-2); |
| 2508 | if (comp->stream->nbStep > ret) |
| 2509 | ret = comp->stream->nbStep; |
| 2510 | comp = comp->next; |
| 2511 | } |
| 2512 | return(ret); |
| 2513 | } |
| 2514 | |
| 2515 | /** |
| 2516 | * xmlPatternMinDepth: |
no outgoing calls
no test coverage detected