tony2001 Mon Jul 14 08:09:09 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/spl spl_fixedarray.c Log: MFH: minor speedup - convert offset to long only when needed http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fixedarray.c?r1=1.1.2.4&r2=1.1.2.5&diff_format=u Index: php-src/ext/spl/spl_fixedarray.c diff -u php-src/ext/spl/spl_fixedarray.c:1.1.2.4 php-src/ext/spl/spl_fixedarray.c:1.1.2.5 --- php-src/ext/spl/spl_fixedarray.c:1.1.2.4 Sun Jul 13 15:59:52 2008 +++ php-src/ext/spl/spl_fixedarray.c Mon Jul 14 08:09:09 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_fixedarray.c,v 1.1.2.4 2008/07/13 15:59:52 colder Exp $ */ +/* $Id: spl_fixedarray.c,v 1.1.2.5 2008/07/14 08:09:09 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -317,7 +317,11 @@ return NULL; } - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_LONG) { + index = spl_offset_convert_to_long(offset TSRMLS_CC); + } else { + index = Z_LVAL_P(offset); + } if (index < 0 || intern->array == NULL || index >= intern->array->size) { zend_throw_exception(spl_ce_RuntimeException, "Index invalid or out of range", 0 TSRMLS_CC); @@ -369,7 +373,11 @@ return; } - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_LONG) { + index = spl_offset_convert_to_long(offset TSRMLS_CC); + } else { + index = Z_LVAL_P(offset); + } if (index < 0 || intern->array == NULL || index >= intern->array->size) { zend_throw_exception(spl_ce_RuntimeException, "Index invalid or out of range", 0 TSRMLS_CC); @@ -407,7 +415,11 @@ { long index; - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_LONG) { + index = spl_offset_convert_to_long(offset TSRMLS_CC); + } else { + index = Z_LVAL_P(offset); + } if (index < 0 || intern->array == NULL || index >= intern->array->size) { zend_throw_exception(spl_ce_RuntimeException, "Index invalid or out of range", 0 TSRMLS_CC); @@ -444,7 +456,11 @@ long index; int retval; - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_LONG) { + index = spl_offset_convert_to_long(offset TSRMLS_CC); + } else { + index = Z_LVAL_P(offset); + } if (index < 0 || intern->array == NULL || index >= intern->array->size) { retval = 0;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php