mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
fixed the serious CPU usage problem reported by Grant Goodale applied
* parser.c: fixed the serious CPU usage problem reported by Grant Goodale * HTMLparser.c: applied patch from Oliver Kidman about a free missing in htmlSAXParseDoc Daniel
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
Thu Aug 14 02:28:36 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* parser.c: fixed the serious CPU usage problem reported by
|
||||||
|
Grant Goodale
|
||||||
|
* HTMLparser.c: applied patch from Oliver Kidman about a free
|
||||||
|
missing in htmlSAXParseDoc
|
||||||
|
|
||||||
Tue Aug 12 22:48:10 HKT 2003 William Brack <wbrack@mmm.com.hk>
|
Tue Aug 12 22:48:10 HKT 2003 William Brack <wbrack@mmm.com.hk>
|
||||||
|
|
||||||
* doc/Makefile.am: Removed dependency from libxml2.def.src
|
* doc/Makefile.am: Removed dependency from libxml2.def.src
|
||||||
|
@ -5322,6 +5322,7 @@ htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void
|
|||||||
ctxt = htmlCreateDocParserCtxt(cur, encoding);
|
ctxt = htmlCreateDocParserCtxt(cur, encoding);
|
||||||
if (ctxt == NULL) return(NULL);
|
if (ctxt == NULL) return(NULL);
|
||||||
if (sax != NULL) {
|
if (sax != NULL) {
|
||||||
|
if (ctxt->sax != NULL) xmlFree (ctxt->sax);
|
||||||
ctxt->sax = sax;
|
ctxt->sax = sax;
|
||||||
ctxt->userData = userData;
|
ctxt->userData = userData;
|
||||||
}
|
}
|
||||||
|
20
parser.c
20
parser.c
@ -369,7 +369,8 @@ static int spacePop(xmlParserCtxtPtr ctxt) {
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define SHRINK if ((ctxt->progressive == 0) && \
|
#define SHRINK if ((ctxt->progressive == 0) && \
|
||||||
(ctxt->input->cur - ctxt->input->base > INPUT_CHUNK))\
|
(ctxt->input->cur - ctxt->input->base > INPUT_CHUNK) && \
|
||||||
|
(ctxt->input->end - ctxt->input->cur < INPUT_CHUNK)) \
|
||||||
xmlSHRINK (ctxt);
|
xmlSHRINK (ctxt);
|
||||||
|
|
||||||
static void xmlSHRINK (xmlParserCtxtPtr ctxt) {
|
static void xmlSHRINK (xmlParserCtxtPtr ctxt) {
|
||||||
@ -7581,8 +7582,21 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
|
|||||||
if ((encoding != NULL) &&
|
if ((encoding != NULL) &&
|
||||||
((!xmlStrcasecmp(encoding, BAD_CAST "UTF-16")) ||
|
((!xmlStrcasecmp(encoding, BAD_CAST "UTF-16")) ||
|
||||||
(!xmlStrcasecmp(encoding, BAD_CAST "UTF16")))) {
|
(!xmlStrcasecmp(encoding, BAD_CAST "UTF16")))) {
|
||||||
xmlFree(encoding);
|
if (ctxt->input->encoding != NULL)
|
||||||
encoding = NULL;
|
xmlFree((xmlChar *) ctxt->input->encoding);
|
||||||
|
ctxt->input->encoding = encoding;
|
||||||
|
encoding = NULL;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* UTF-8 encoding is handled natively
|
||||||
|
*/
|
||||||
|
if ((encoding != NULL) &&
|
||||||
|
((!xmlStrcasecmp(encoding, BAD_CAST "UTF-8")) ||
|
||||||
|
(!xmlStrcasecmp(encoding, BAD_CAST "UTF8")))) {
|
||||||
|
if (ctxt->input->encoding != NULL)
|
||||||
|
xmlFree((xmlChar *) ctxt->input->encoding);
|
||||||
|
ctxt->input->encoding = encoding;
|
||||||
|
encoding = NULL;
|
||||||
}
|
}
|
||||||
if (encoding != NULL) {
|
if (encoding != NULL) {
|
||||||
xmlCharEncodingHandlerPtr handler;
|
xmlCharEncodingHandlerPtr handler;
|
||||||
|
Reference in New Issue
Block a user