mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Get rid of separate DOM HashPosition member (#18354)
Besides the fact that this is only used for DOM_NODESET and thus makes no sense of being on the iterator itself, it's also redundant now that we have the index member.
This commit is contained in:
parent
2e7df9e423
commit
91a310e603
2 changed files with 5 additions and 9 deletions
|
@ -189,9 +189,8 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter) /* {{{ */
|
||||||
objmap->nodetype != XML_NOTATION_NODE) {
|
objmap->nodetype != XML_NOTATION_NODE) {
|
||||||
if (objmap->nodetype == DOM_NODESET) {
|
if (objmap->nodetype == DOM_NODESET) {
|
||||||
HashTable *nodeht = Z_ARRVAL_P(&objmap->baseobj_zv);
|
HashTable *nodeht = Z_ARRVAL_P(&objmap->baseobj_zv);
|
||||||
zval *entry;
|
zval *entry = zend_hash_index_find(nodeht, iterator->index);
|
||||||
zend_hash_move_forward_ex(nodeht, &iterator->pos);
|
if (entry) {
|
||||||
if ((entry = zend_hash_get_current_data_ex(nodeht, &iterator->pos))) {
|
|
||||||
zval_ptr_dtor(&iterator->curobj);
|
zval_ptr_dtor(&iterator->curobj);
|
||||||
ZVAL_COPY(&iterator->curobj, entry);
|
ZVAL_COPY(&iterator->curobj, entry);
|
||||||
return;
|
return;
|
||||||
|
@ -263,8 +262,6 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, i
|
||||||
dom_object *intern;
|
dom_object *intern;
|
||||||
dom_nnodemap_object *objmap;
|
dom_nnodemap_object *objmap;
|
||||||
xmlNodePtr curnode=NULL;
|
xmlNodePtr curnode=NULL;
|
||||||
HashTable *nodeht;
|
|
||||||
zval *entry;
|
|
||||||
php_dom_iterator *iterator;
|
php_dom_iterator *iterator;
|
||||||
|
|
||||||
if (by_ref) {
|
if (by_ref) {
|
||||||
|
@ -284,9 +281,9 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, i
|
||||||
if (objmap->nodetype != XML_ENTITY_NODE &&
|
if (objmap->nodetype != XML_ENTITY_NODE &&
|
||||||
objmap->nodetype != XML_NOTATION_NODE) {
|
objmap->nodetype != XML_NOTATION_NODE) {
|
||||||
if (objmap->nodetype == DOM_NODESET) {
|
if (objmap->nodetype == DOM_NODESET) {
|
||||||
nodeht = Z_ARRVAL_P(&objmap->baseobj_zv);
|
HashTable *nodeht = Z_ARRVAL_P(&objmap->baseobj_zv);
|
||||||
zend_hash_internal_pointer_reset_ex(nodeht, &iterator->pos);
|
zval *entry = zend_hash_index_find(nodeht, 0);
|
||||||
if ((entry = zend_hash_get_current_data_ex(nodeht, &iterator->pos))) {
|
if (entry) {
|
||||||
ZVAL_COPY(&iterator->curobj, entry);
|
ZVAL_COPY(&iterator->curobj, entry);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -97,7 +97,6 @@ typedef struct dom_nnodemap_object {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
zend_object_iterator intern;
|
zend_object_iterator intern;
|
||||||
zval curobj;
|
zval curobj;
|
||||||
HashPosition pos;
|
|
||||||
/* intern->index is only updated for FE_* opcodes, not for e.g. unpacking,
|
/* intern->index is only updated for FE_* opcodes, not for e.g. unpacking,
|
||||||
* yet we need to track the position of the node relative to the start. */
|
* yet we need to track the position of the node relative to the start. */
|
||||||
zend_ulong index;
|
zend_ulong index;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue