mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Avoid string allocation in dom_get_dom1_attribute() for as long as possible
This commit is contained in:
parent
66e2aa7255
commit
9880c336be
1 changed files with 2 additions and 3 deletions
|
@ -159,8 +159,7 @@ static xmlNodePtr dom_get_dom1_attribute(xmlNodePtr elem, xmlChar *name) /* {{{
|
|||
nqname = xmlSplitQName3(name, &len);
|
||||
if (nqname != NULL) {
|
||||
xmlNsPtr ns;
|
||||
xmlChar *prefix = xmlStrndup(name, len);
|
||||
if (prefix && xmlStrEqual(prefix, (xmlChar *)"xmlns")) {
|
||||
if (strncmp((const char *) name, "xmlns:", len + 1) == 0) {
|
||||
ns = elem->nsDef;
|
||||
while (ns) {
|
||||
if (xmlStrEqual(ns->prefix, nqname)) {
|
||||
|
@ -168,9 +167,9 @@ static xmlNodePtr dom_get_dom1_attribute(xmlNodePtr elem, xmlChar *name) /* {{{
|
|||
}
|
||||
ns = ns->next;
|
||||
}
|
||||
xmlFree(prefix);
|
||||
return (xmlNodePtr)ns;
|
||||
}
|
||||
xmlChar *prefix = xmlStrndup(name, len);
|
||||
ns = xmlSearchNs(elem->doc, elem, prefix);
|
||||
if (prefix != NULL) {
|
||||
xmlFree(prefix);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue