diff options
author | Daniel Veillard <veillard@redhat.com> | 2013-03-11 13:57:53 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2013-03-11 15:59:21 +0800 |
commit | a3f1e3e5712257fd279917a9158278534e8f4b72 (patch) | |
tree | 903a9d93764ee67a60b95d5838fa69b277fff665 /parser.c | |
parent | a09890684c71fcfcc13c2c4c8731cbb6e9d923f8 (diff) | |
download | android_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.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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); |