com php-src: Save one condition: ext/standard/array.c

From: Date: Thu, 15 Jan 2015 10:41:25 +0000
Subject: com php-src: Save one condition: ext/standard/array.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-84107@lists.php.net to get a copy of this message
Commit: 9aac41753b2478fbba69a89332b77f62d142f35c Author: Xinchen Hui <laruence@php.net> Thu, 15 Jan 2015 18:41:25 +0800 Parents: 1af91d944aabad42014c0e34cbf54e89a87590b1 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9aac41753b2478fbba69a89332b77f62d142f35c Log: Save one condition Changed paths: M ext/standard/array.c Diff: diff --git a/ext/standard/array.c b/ext/standard/array.c index 0b50cf3..fcf901c 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -2408,13 +2408,14 @@ PHP_FUNCTION(array_slice) length = num_in - offset; } - /* Initialize returned array */ - array_init_size(return_value, length > 0 ? (uint32_t)length : 0); - if (length <= 0) { + array_init(return_value); return; } + /* Initialize returned array */ + array_init_size(return_value, (uint32_t)length); + /* Start at the beginning and go until we hit offset */ pos = 0; ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_key, string_key, entry) {

« previous php.cvs (#84107) next »