diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2002-03-20 19:24:21 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2002-03-20 19:24:21 +0000 |
commit | e50f3b5d54496e3afb411a9c3012c697b75eb34e (patch) | |
tree | ba2929e5f7179fda994f03b8cbe28baff3c475ce /HTMLparser.c | |
parent | c62a147963b5839fc815267706eaec381f90ca16 (diff) | |
download | android_external_libxml2-e50f3b5d54496e3afb411a9c3012c697b75eb34e.tar.gz android_external_libxml2-e50f3b5d54496e3afb411a9c3012c697b75eb34e.tar.bz2 android_external_libxml2-e50f3b5d54496e3afb411a9c3012c697b75eb34e.zip |
I wanted to see the real speed at the SAX interface after a little too
* testSAX.c: I wanted to see the real speed at the SAX interface
after a little too many Ximianer started complaining about the
parser speed.
added a --quiet option:
paphio:~/XML -> ls -l db100000.xml
-rw-rw-r-- 1 veillard www 20182040 Mar 20 10:30 db100000.xml
paphio:~/XML -> time ./testSAX --quiet db100000.xml
3200006 callbacks generated
real 0m1.270s
Which means 16MBytes/s and 3Mcallback/s
Daniel
Diffstat (limited to 'HTMLparser.c')
-rw-r--r-- | HTMLparser.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/HTMLparser.c b/HTMLparser.c index 4c819d1b..f5da2983 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -147,11 +147,12 @@ PUSH_AND_POP(static, xmlChar*, name) /* Inported from XML */ -/* #define CUR (ctxt->token ? ctxt->token : (int) (*ctxt->input->cur)) */ -#define CUR ((int) (*ctxt->input->cur)) +#define CUR ((ctxt->input->cur < ctxt->input->end) ? (*ctxt->input->cur) : 0) #define NEXT xmlNextChar(ctxt),ctxt->nbChars++ +#define AVAIL (ctxt->input->end - ctxt->input->cur) -#define RAW (ctxt->token ? -1 : (*ctxt->input->cur)) +#define RAW (ctxt->token ? -1 : \ + (ctxt->input->cur < ctxt->input->end) ? (*ctxt->input->cur) : 0) #define NXT(val) ctxt->input->cur[(val)] #define CUR_PTR ctxt->input->cur @@ -3047,8 +3048,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { else { /* Dump the bogus attribute string up to the next blank or * the end of the tag. */ - while ((IS_CHAR(CUR)) && !(IS_BLANK(CUR)) && (CUR != '>') - && ((CUR != '/') || (NXT(1) != '>'))) + while ((AVAIL > 0) && (IS_CHAR(CUR)) && !(IS_BLANK(CUR)) && + (CUR != '>') && ((CUR != '/') || (NXT(1) != '>'))) NEXT; } @@ -4670,6 +4671,8 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, xmlParserInputBufferPush(ctxt->input->buf, size, chunk); ctxt->input->base = ctxt->input->buf->buffer->content + base; ctxt->input->cur = ctxt->input->base + cur; + ctxt->input->end = ctxt->input->buf->buffer->content + + ctxt->input->buf->buffer->use; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size); #endif |