mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +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);
|
nqname = xmlSplitQName3(name, &len);
|
||||||
if (nqname != NULL) {
|
if (nqname != NULL) {
|
||||||
xmlNsPtr ns;
|
xmlNsPtr ns;
|
||||||
xmlChar *prefix = xmlStrndup(name, len);
|
if (strncmp((const char *) name, "xmlns:", len + 1) == 0) {
|
||||||
if (prefix && xmlStrEqual(prefix, (xmlChar *)"xmlns")) {
|
|
||||||
ns = elem->nsDef;
|
ns = elem->nsDef;
|
||||||
while (ns) {
|
while (ns) {
|
||||||
if (xmlStrEqual(ns->prefix, nqname)) {
|
if (xmlStrEqual(ns->prefix, nqname)) {
|
||||||
|
@ -168,9 +167,9 @@ static xmlNodePtr dom_get_dom1_attribute(xmlNodePtr elem, xmlChar *name) /* {{{
|
||||||
}
|
}
|
||||||
ns = ns->next;
|
ns = ns->next;
|
||||||
}
|
}
|
||||||
xmlFree(prefix);
|
|
||||||
return (xmlNodePtr)ns;
|
return (xmlNodePtr)ns;
|
||||||
}
|
}
|
||||||
|
xmlChar *prefix = xmlStrndup(name, len);
|
||||||
ns = xmlSearchNs(elem->doc, elem, prefix);
|
ns = xmlSearchNs(elem->doc, elem, prefix);
|
||||||
if (prefix != NULL) {
|
if (prefix != NULL) {
|
||||||
xmlFree(prefix);
|
xmlFree(prefix);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue