diff options
author | Aron Xu <aron@debian.org> | 2013-06-09 00:17:44 +0800 |
---|---|---|
committer | Aron Xu <aron@debian.org> | 2013-06-09 00:17:44 +0800 |
commit | 2c8fe012ef1ff6e0613480dd182dec099aa9636e (patch) | |
tree | f220f4e6733d3204aef57831a8dee2dd8551ed40 /xmllint.c | |
parent | 3c845c4be476dc0ecb93388de9cfedb3f611e6a8 (diff) | |
download | libxml2-2c8fe012ef1ff6e0613480dd182dec099aa9636e.tar.gz |
Imported Upstream version 2.9.1upstream/2.9.1
Diffstat (limited to 'xmllint.c')
-rw-r--r-- | xmllint.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -168,6 +168,7 @@ static int nodefdtd = 0; #endif #ifdef LIBXML_PUSH_ENABLED static int push = 0; +static int pushsize = 4096; #endif /* LIBXML_PUSH_ENABLED */ #ifdef HAVE_MMAP static int memory = 0; @@ -1874,7 +1875,8 @@ static void streamFile(char *filename) { xmlTextReaderSetParserProp(reader, XML_PARSER_VALIDATE, 1); else #endif /* LIBXML_VALID_ENABLED */ - xmlTextReaderSetParserProp(reader, XML_PARSER_LOADDTD, 1); + if (loaddtd) + xmlTextReaderSetParserProp(reader, XML_PARSER_LOADDTD, 1); #ifdef LIBXML_SCHEMAS_ENABLED if (relaxng != NULL) { if ((timing) && (!repeat)) { @@ -2192,17 +2194,15 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { f = fopen(filename, "r"); #endif if (f != NULL) { - int res, size = 3; + int res; char chars[4096]; htmlParserCtxtPtr ctxt; - /* if (repeat) */ - size = 4096; res = fread(chars, 1, 4, f); if (res > 0) { ctxt = htmlCreatePushParserCtxt(NULL, NULL, chars, res, filename, XML_CHAR_ENCODING_NONE); - while ((res = fread(chars, 1, size, f)) > 0) { + while ((res = fread(chars, 1, pushsize, f)) > 0) { htmlParseChunk(ctxt, chars, res, 0); } htmlParseChunk(ctxt, chars, 0, 1); @@ -3017,6 +3017,7 @@ static void usage(const char *name) { #endif #ifdef LIBXML_PUSH_ENABLED printf("\t--push : use the push mode of the parser\n"); + printf("\t--pushsmall : use the push mode of the parser using tiny increments\n"); #endif /* LIBXML_PUSH_ENABLED */ #ifdef HAVE_MMAP printf("\t--memory : parse from memory\n"); @@ -3076,7 +3077,7 @@ static void usage(const char *name) { printf("\t--sax: do not build a tree but work just at the SAX level\n"); printf("\t--oldxml10: use XML-1.0 parsing rules before the 5th edition\n"); #ifdef LIBXML_XPATH_ENABLED - printf("\t--xpath expr: evaluate the XPath expression, inply --noout\n"); + printf("\t--xpath expr: evaluate the XPath expression, imply --noout\n"); #endif printf("\nLibxml project home page: http://xmlsoft.org/\n"); @@ -3247,6 +3248,11 @@ main(int argc, char **argv) { else if ((!strcmp(argv[i], "-push")) || (!strcmp(argv[i], "--push"))) push++; + else if ((!strcmp(argv[i], "-pushsmall")) || + (!strcmp(argv[i], "--pushsmall"))) { + push++; + pushsize = 10; + } #endif /* LIBXML_PUSH_ENABLED */ #ifdef HAVE_MMAP else if ((!strcmp(argv[i], "-memory")) || |