| 3369 | */ |
| 3370 | |
| 3371 | const xmlChar * |
| 3372 | xmlParseName(xmlParserCtxtPtr ctxt) { |
| 3373 | const xmlChar *in; |
| 3374 | const xmlChar *ret; |
| 3375 | size_t count = 0; |
| 3376 | size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ? |
| 3377 | XML_MAX_TEXT_LENGTH : |
| 3378 | XML_MAX_NAME_LENGTH; |
| 3379 | |
| 3380 | GROW; |
| 3381 | |
| 3382 | /* |
| 3383 | * Accelerator for simple ASCII names |
| 3384 | */ |
| 3385 | in = ctxt->input->cur; |
| 3386 | if (((*in >= 0x61) && (*in <= 0x7A)) || |
| 3387 | ((*in >= 0x41) && (*in <= 0x5A)) || |
| 3388 | (*in == '_') || (*in == ':')) { |
| 3389 | in++; |
| 3390 | while (((*in >= 0x61) && (*in <= 0x7A)) || |
| 3391 | ((*in >= 0x41) && (*in <= 0x5A)) || |
| 3392 | ((*in >= 0x30) && (*in <= 0x39)) || |
| 3393 | (*in == '_') || (*in == '-') || |
| 3394 | (*in == ':') || (*in == '.')) |
| 3395 | in++; |
| 3396 | if ((*in > 0) && (*in < 0x80)) { |
| 3397 | count = in - ctxt->input->cur; |
| 3398 | if (count > maxLength) { |
| 3399 | xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name"); |
| 3400 | return(NULL); |
| 3401 | } |
| 3402 | ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); |
| 3403 | ctxt->input->cur = in; |
| 3404 | ctxt->input->col += count; |
| 3405 | if (ret == NULL) |
| 3406 | xmlErrMemory(ctxt); |
| 3407 | return(ret); |
| 3408 | } |
| 3409 | } |
| 3410 | /* accelerator for special cases */ |
| 3411 | return(xmlParseNameComplex(ctxt)); |
| 3412 | } |
| 3413 | |
| 3414 | static xmlHashedString |
| 3415 | xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { |
no test coverage detected