Skip to content

Commit 9304196

Browse files
committed
ext/spl: inline HT_MOVE_TAIL_TO_HEAD macro
This is used only once anyway
1 parent f8b3a0b commit 9304196

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

ext/spl/php_spl.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -398,16 +398,6 @@ PHP_FUNCTION(spl_autoload_call)
398398
zend_string_release(lc_name);
399399
} /* }}} */
400400

401-
#define HT_MOVE_TAIL_TO_HEAD(ht) \
402-
ZEND_ASSERT(!HT_IS_PACKED(ht)); \
403-
do { \
404-
Bucket tmp = (ht)->arData[(ht)->nNumUsed-1]; \
405-
memmove((ht)->arData + 1, (ht)->arData, \
406-
sizeof(Bucket) * ((ht)->nNumUsed - 1)); \
407-
(ht)->arData[0] = tmp; \
408-
zend_hash_rehash(ht); \
409-
} while (0)
410-
411401
static Bucket *spl_find_registered_function(const zend_fcall_info_cache *find_fcc) {
412402
if (!spl_autoload_functions) {
413403
return NULL;
@@ -478,7 +468,11 @@ PHP_FUNCTION(spl_autoload_register)
478468
zend_hash_next_index_insert_ptr(spl_autoload_functions, entry);
479469
if (prepend && spl_autoload_functions->nNumOfElements > 1) {
480470
/* Move the newly created element to the head of the hashtable */
481-
HT_MOVE_TAIL_TO_HEAD(spl_autoload_functions);
471+
ZEND_ASSERT(!HT_IS_PACKED(spl_autoload_functions));
472+
Bucket tmp = spl_autoload_functions->arData[spl_autoload_functions->nNumUsed-1];
473+
memmove(spl_autoload_functions->arData + 1, spl_autoload_functions->arData, sizeof(Bucket) * (spl_autoload_functions->nNumUsed - 1));
474+
spl_autoload_functions->arData[0] = tmp;
475+
zend_hash_rehash(spl_autoload_functions);
482476
}
483477

484478
RETURN_TRUE;

0 commit comments

Comments
 (0)