diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2005-02-01 16:21:43 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2005-02-01 16:21:43 +0000 |
commit | 9740d1d42595ec01cafcfe49c7217229fd8b5bb8 (patch) | |
tree | 7f3f642a2645b2b442b881eae5ef341b6ebc47bc /pattern.c | |
parent | 0a5985283bfe50309f8b709931f8ee3e56c82443 (diff) | |
download | android_external_libxml2-9740d1d42595ec01cafcfe49c7217229fd8b5bb8.tar.gz android_external_libxml2-9740d1d42595ec01cafcfe49c7217229fd8b5bb8.tar.bz2 android_external_libxml2-9740d1d42595ec01cafcfe49c7217229fd8b5bb8.zip |
more bug fixes for the XPath streaming code. Daniel
* pattern.c: more bug fixes for the XPath streaming code.
Daniel
Diffstat (limited to 'pattern.c')
-rw-r--r-- | pattern.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -39,7 +39,7 @@ #ifdef LIBXML_PATTERN_ENABLED -/* #define DEBUG_STREAMING */ +#define DEBUG_STREAMING #define ERROR(a, b, c, d) #define ERROR5(a, b, c, d, e) @@ -1029,7 +1029,6 @@ xmlDebugStreamCtxt(xmlStreamCtxtPtr ctxt, int match) { else printf("\n"); } - printf("\n"); } } #endif @@ -1369,9 +1368,11 @@ xmlStreamPush(xmlStreamCtxtPtr stream, xmlStreamCtxtAddState(stream, step + 1, stream->level + 1); } } +#if 0 } else if (!desc) { /* didn't match, discard */ stream->states[2 * i] = -1; +#endif } } @@ -1426,13 +1427,24 @@ xmlStreamPush(xmlStreamCtxtPtr stream, */ int xmlStreamPop(xmlStreamCtxtPtr stream) { + int i, m; + if (stream == NULL) return(-1); stream->level--; if (stream->level < 0) return(-1); - /* something is certainly needed here */ + /* + * Check evolution of existing states + */ + m = stream->nbState; + for (i = 0;i < m;i++) { + if (stream->states[(2 * i)] < 0) break; + /* discard obsoleted states */ + if (stream->states[(2 * i) + 1] > stream->level) + stream->states[(2 * i)] = -1; + } return(0); } |