mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Don't use a heap allocation to track the current item
This commit is contained in:
parent
6de0486e19
commit
aa19461151
1 changed files with 6 additions and 10 deletions
|
@ -76,19 +76,15 @@ xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const
|
||||||
|
|
||||||
xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index) /* {{{ */
|
xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index) /* {{{ */
|
||||||
{
|
{
|
||||||
xmlNode *nodep = NULL;
|
|
||||||
nodeIterator *iter;
|
|
||||||
int htsize;
|
int htsize;
|
||||||
|
|
||||||
if ((htsize = xmlHashSize(ht)) > 0 && index < htsize) {
|
if ((htsize = xmlHashSize(ht)) > 0 && index < htsize) {
|
||||||
iter = emalloc(sizeof(nodeIterator));
|
nodeIterator iter;
|
||||||
iter->cur = 0;
|
iter.cur = 0;
|
||||||
iter->index = index;
|
iter.index = index;
|
||||||
iter->node = NULL;
|
iter.node = NULL;
|
||||||
xmlHashScan(ht, itemHashScanner, iter);
|
xmlHashScan(ht, itemHashScanner, &iter);
|
||||||
nodep = iter->node;
|
return iter.node;
|
||||||
efree(iter);
|
|
||||||
return nodep;
|
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue