Don't use a heap allocation to track the current item

This commit is contained in:
Niels Dossche 2024-04-02 22:58:22 +02:00
parent 6de0486e19
commit aa19461151

View file

@ -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;
} }