Skip to content

Commit 28344e0

Browse files
authored
Get rid of HASH_OF() in ext/dom (#16767)
The cases where this is used are only where an array is possible, so we can replace them with Z_ARRVAL_P. This reduces some overhead.
1 parent b948332 commit 28344e0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ext/dom/dom_iterators.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter) /* {{{ */
177177
if (objmap->nodetype != XML_ENTITY_NODE &&
178178
objmap->nodetype != XML_NOTATION_NODE) {
179179
if (objmap->nodetype == DOM_NODESET) {
180-
HashTable *nodeht = HASH_OF(&objmap->baseobj_zv);
180+
HashTable *nodeht = Z_ARRVAL_P(&objmap->baseobj_zv);
181181
zval *entry;
182182
zend_hash_move_forward_ex(nodeht, &iterator->pos);
183183
if ((entry = zend_hash_get_current_data_ex(nodeht, &iterator->pos))) {
@@ -275,7 +275,7 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, i
275275
if (objmap->nodetype != XML_ENTITY_NODE &&
276276
objmap->nodetype != XML_NOTATION_NODE) {
277277
if (objmap->nodetype == DOM_NODESET) {
278-
nodeht = HASH_OF(&objmap->baseobj_zv);
278+
nodeht = Z_ARRVAL_P(&objmap->baseobj_zv);
279279
zend_hash_internal_pointer_reset_ex(nodeht, &iterator->pos);
280280
if ((entry = zend_hash_get_current_data_ex(nodeht, &iterator->pos))) {
281281
ZVAL_COPY(&iterator->curobj, entry);

ext/dom/nodelist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ zend_long php_dom_get_nodelist_length(dom_object *obj)
7272
}
7373

7474
if (objmap->nodetype == DOM_NODESET) {
75-
HashTable *nodeht = HASH_OF(&objmap->baseobj_zv);
75+
HashTable *nodeht = Z_ARRVAL_P(&objmap->baseobj_zv);
7676
return zend_hash_num_elements(nodeht);
7777
}
7878

@@ -145,7 +145,7 @@ void php_dom_nodelist_get_item_into_zval(dom_nnodemap_object *objmap, zend_long
145145
itemnode = php_dom_libxml_hash_iter(objmap, index);
146146
} else {
147147
if (objmap->nodetype == DOM_NODESET) {
148-
HashTable *nodeht = HASH_OF(&objmap->baseobj_zv);
148+
HashTable *nodeht = Z_ARRVAL_P(&objmap->baseobj_zv);
149149
zval *entry = zend_hash_index_find(nodeht, index);
150150
if (entry) {
151151
ZVAL_COPY(return_value, entry);

0 commit comments

Comments
 (0)