aboutsummaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2013-03-11 13:57:53 +0800
committerDaniel Veillard <veillard@redhat.com>2013-03-11 15:59:21 +0800
commita3f1e3e5712257fd279917a9158278534e8f4b72 (patch)
tree903a9d93764ee67a60b95d5838fa69b277fff665 /parser.c
parenta09890684c71fcfcc13c2c4c8731cbb6e9d923f8 (diff)
downloadandroid_external_libxml2-a3f1e3e5712257fd279917a9158278534e8f4b72.tar.gz
android_external_libxml2-a3f1e3e5712257fd279917a9158278534e8f4b72.tar.bz2
android_external_libxml2-a3f1e3e5712257fd279917a9158278534e8f4b72.zip
Avoid extra processing on entities
If an entity has already been checked for correctness no need to check it on every reference
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/parser.c b/parser.c
index ddf3b5bd..362186be 100644
--- a/parser.c
+++ b/parser.c
@@ -4044,9 +4044,13 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
* entities problems
*/
if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
- (ent->content != NULL)) {
+ (ent->content != NULL) && (ent->checked == 0)) {
+ unsigned long oldnbent = ctxt->nbentities;
+
rep = xmlStringDecodeEntities(ctxt, ent->content,
XML_SUBSTITUTE_REF, 0, 0, 0);
+
+ ent->checked = ctxt->nbentities - oldnbent + 1;
if (rep != NULL) {
xmlFree(rep);
rep = NULL;
@@ -7213,7 +7217,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
* Store the number of entities needing parsing for this entity
* content and do checkings
*/
- ent->checked = ctxt->nbentities - oldnbent;
+ ent->checked = ctxt->nbentities - oldnbent + 1;
if (ret == XML_ERR_ENTITY_LOOP) {
xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
xmlFreeNodeList(list);