summaryrefslogtreecommitdiff
path: root/ext/spl/php_spl.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2014-07-30 10:47:03 +0800
committerXinchen Hui <laruence@php.net>2014-07-30 10:47:03 +0800
commit2147799524b16a088c72d23221a8d808d0aff45c (patch)
tree96d1200eef14cc81f88636d953c6bee9a8c7a15e /ext/spl/php_spl.c
parenta0a4eb23ee9631e52bd604540a55ba8e66825488 (diff)
parent70fb0e751913a408e7906adba8bcaff08da44e9e (diff)
downloadphp-git-2147799524b16a088c72d23221a8d808d0aff45c.tar.gz
Merge branch 'phpng' of https://git.php.net/repository/php-src into phpng
Diffstat (limited to 'ext/spl/php_spl.c')
-rw-r--r--ext/spl/php_spl.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index d765d6b754..62cf6ae144 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -441,24 +441,11 @@ PHP_FUNCTION(spl_autoload_call)
#define HT_MOVE_TAIL_TO_HEAD(ht) \
do { \
- uint first = 0; \
- uint last = (ht)->nNumUsed; \
- while (first < last) { \
- if (Z_TYPE((ht)->arData[first].val) != IS_UNDEF) \
- break; \
- first++; \
- } \
- while (last > first) { \
- last--; \
- if (Z_TYPE((ht)->arData[last].val) != IS_UNDEF) \
- break; \
- } \
- if (first != last) { \
- Bucket tmp = (ht)->arData[first]; \
- (ht)->arData[first] = (ht)->arData[last]; \
- (ht)->arData[last] = tmp; \
- zend_hash_rehash(ht); \
- } \
+ Bucket tmp = (ht)->arData[(ht)->nNumUsed-1]; \
+ memmove((ht)->arData + 1, (ht)->arData, \
+ sizeof(Bucket) * ((ht)->nNumUsed - 1)); \
+ (ht)->arData[0] = tmp; \
+ zend_hash_rehash(ht); \
} while (0)
/* {{{ proto bool spl_autoload_register([mixed autoload_function = "spl_autoload" [, throw = true [, prepend]]])