mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
fixed xmllint --memory --stream memory consumption on large file by using
* xmlreader.c: fixed xmllint --memory --stream memory consumption on large file by using xmlParserInputBufferCreateStatic() with the mmap'ed file Daniel
This commit is contained in:
parent
49138f1933
commit
219245203a
@ -1,3 +1,9 @@
|
|||||||
|
Thu Feb 19 17:33:36 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xmlreader.c: fixed xmllint --memory --stream memory consumption
|
||||||
|
on large file by using xmlParserInputBufferCreateStatic() with
|
||||||
|
the mmap'ed file
|
||||||
|
|
||||||
Thu Feb 19 13:56:53 CET 2004 Daniel Veillard <daniel@veillard.com>
|
Thu Feb 19 13:56:53 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* tree.c: some clarification in xmlDocDumpMemory() documentation
|
* tree.c: some clarification in xmlDocDumpMemory() documentation
|
||||||
|
20
xmlreader.c
20
xmlreader.c
@ -792,9 +792,6 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
|
|||||||
if (inbuf->use == reader->cur) {
|
if (inbuf->use == reader->cur) {
|
||||||
reader->mode = XML_TEXTREADER_MODE_EOF;
|
reader->mode = XML_TEXTREADER_MODE_EOF;
|
||||||
reader->state = oldstate;
|
reader->state = oldstate;
|
||||||
if ((oldstate != XML_TEXTREADER_START) ||
|
|
||||||
(reader->ctxt->myDoc != NULL))
|
|
||||||
return(val);
|
|
||||||
}
|
}
|
||||||
} else if (val < 0) {
|
} else if (val < 0) {
|
||||||
reader->mode = XML_TEXTREADER_MODE_EOF;
|
reader->mode = XML_TEXTREADER_MODE_EOF;
|
||||||
@ -838,11 +835,13 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
|
|||||||
* Discard the consumed input when needed and possible
|
* Discard the consumed input when needed and possible
|
||||||
*/
|
*/
|
||||||
if (reader->mode == XML_TEXTREADER_MODE_INTERACTIVE) {
|
if (reader->mode == XML_TEXTREADER_MODE_INTERACTIVE) {
|
||||||
if ((reader->cur >= 4096) &&
|
if (inbuf->alloc != XML_BUFFER_ALLOC_IMMUTABLE) {
|
||||||
(inbuf->use - reader->cur <= CHUNK_SIZE)) {
|
if ((reader->cur >= 4096) &&
|
||||||
val = xmlBufferShrink(inbuf, reader->cur);
|
(inbuf->use - reader->cur <= CHUNK_SIZE)) {
|
||||||
if (val >= 0) {
|
val = xmlBufferShrink(inbuf, reader->cur);
|
||||||
reader->cur -= val;
|
if (val >= 0) {
|
||||||
|
reader->cur -= val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4377,8 +4376,7 @@ xmlReaderForMemory(const char *buffer, int size, const char *URL,
|
|||||||
xmlTextReaderPtr reader;
|
xmlTextReaderPtr reader;
|
||||||
xmlParserInputBufferPtr buf;
|
xmlParserInputBufferPtr buf;
|
||||||
|
|
||||||
buf =
|
buf = xmlParserInputBufferCreateStatic(buffer, size,
|
||||||
xmlParserInputBufferCreateMem(buffer, size,
|
|
||||||
XML_CHAR_ENCODING_NONE);
|
XML_CHAR_ENCODING_NONE);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -4599,7 +4597,7 @@ xmlReaderNewMemory(xmlTextReaderPtr reader, const char *buffer, int size,
|
|||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
input = xmlParserInputBufferCreateMem(buffer, size,
|
input = xmlParserInputBufferCreateStatic(buffer, size,
|
||||||
XML_CHAR_ENCODING_NONE);
|
XML_CHAR_ENCODING_NONE);
|
||||||
if (input == NULL) {
|
if (input == NULL) {
|
||||||
return (-1);
|
return (-1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user