diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-06-03 13:10:42 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-06-03 13:10:42 +0400 |
commit | 3f6f0d5a700a7de777336569846fa2bfe23c667c (patch) | |
tree | e120f8bfc68c0fa6951ce16aaab2ebcc3d842c10 /ext/spl/spl_engine.c | |
parent | bc2ba841f94515170c4c1311cdde5a1a366db037 (diff) | |
download | php-git-3f6f0d5a700a7de777336569846fa2bfe23c667c.tar.gz |
Simplified and optimized ZEND_HANDLE_NUMERIC()
Diffstat (limited to 'ext/spl/spl_engine.c')
-rw-r--r-- | ext/spl/spl_engine.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c index a2f3653432..0cfcb8ee18 100644 --- a/ext/spl/spl_engine.c +++ b/ext/spl/spl_engine.c @@ -42,9 +42,13 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC) /* {{{ */ { + ulong idx; + switch (Z_TYPE_P(offset)) { case IS_STRING: - ZEND_HANDLE_NUMERIC(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, idx); + if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), idx)) { + return idx; + } break; case IS_DOUBLE: return (long)Z_DVAL_P(offset); |