1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

another peroformance patch from Peter Jacobi, that time on parsing

* parser.c: another peroformance patch from Peter Jacobi, that
  time on parsing attribute values.
Daniel
This commit is contained in:
Daniel Veillard
2002-05-31 09:47:30 +00:00
parent 617acc3c2e
commit e72c756366
3 changed files with 64 additions and 22 deletions

View File

@ -2225,8 +2225,46 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
* Returns the AttValue parsed or NULL. The value has to be freed by the caller.
*/
xmlChar *
xmlParseAttValueComplex(xmlParserCtxtPtr ctxt);
xmlChar *
xmlParseAttValue(xmlParserCtxtPtr ctxt) {
xmlChar limit = 0;
xmlChar *buf = NULL;
xmlChar *in = NULL;
xmlChar *ret = NULL;
SHRINK;
GROW;
in = CUR_PTR;
if (*in != '"' && *in != '\'') {
ctxt->errNo = XML_ERR_ATTRIBUTE_NOT_STARTED;
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData, "AttValue: \" or ' expected\n");
ctxt->wellFormed = 0;
ctxt->disableSAX = 1;
return(NULL);
}
ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE;
limit = *in;
++in;
while (*in != limit && *in >= 0x20 && *in <= 0x7f &&
*in != '&' && *in != '<'
) {
++in;
}
if (*in != limit) {
return xmlParseAttValueComplex(ctxt);
}
++in;
ret = xmlStrndup (CUR_PTR + 1, in - CUR_PTR - 2);
CUR_PTR = in;
return ret;
}
xmlChar *
xmlParseAttValueComplex(xmlParserCtxtPtr ctxt) {
xmlChar limit = 0;
xmlChar *buf = NULL;
int len = 0;