andrei Thu Jul 13 22:26:43 2006 UTC
Modified files:
/php-src unicode-progress.txt
/php-src/ext/standard array.c
Log:
Update array_sum() and array_product() (U).
http://cvs.php.net/viewvc.cgi/php-src/unicode-progress.txt?r1=1.15&r2=1.16&diff_format=u
Index: php-src/unicode-progress.txt
diff -u php-src/unicode-progress.txt:1.15 php-src/unicode-progress.txt:1.16
--- php-src/unicode-progress.txt:1.15 Thu Jul 13 22:03:42 2006
+++ php-src/unicode-progress.txt Thu Jul 13 22:26:42 2006
@@ -55,9 +55,6 @@
array_pad()
Params API, test
- array_product()
- Params API, test
-
array_push(), array_pop(), array_shift(), array_unshift()
Params API, test
@@ -79,9 +76,6 @@
array_slice()
Params API, test
- array_sum()
- Params API, test
-
array_unique()
Params API, test
@@ -105,7 +99,7 @@
Either port strnatcmp() to support Unicode or maybe use ICU's numeric
collation
usort(), uasort(), uksort()
- function name normalization, FCI cache
+ Params API, callback name normalization, FCI cache
Completed
@@ -116,6 +110,8 @@
array_chunk()
array_merge()
array_merge_recursive()
+ array_product()
+ array_sum()
compact()
count()
min()
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.353&r2=1.354&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.353 php-src/ext/standard/array.c:1.354
--- php-src/ext/standard/array.c:1.353 Thu Jul 13 22:03:42 2006
+++ php-src/ext/standard/array.c Thu Jul 13 22:26:42 2006
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.353 2006/07/13 22:03:42 andrei Exp $ */
+/* $Id: array.c,v 1.354 2006/07/13 22:26:42 andrei Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -4142,31 +4142,25 @@
}
/* }}} */
-/* {{{ proto mixed array_sum(array input)
+/* {{{ proto mixed array_sum(array input) U
Returns the sum of the array entries */
PHP_FUNCTION(array_sum)
{
- zval **input,
+ zval *input,
**entry,
entry_n;
- int argc = ZEND_NUM_ARGS();
HashPosition pos;
double dval;
- if (argc != 1 || zend_get_parameters_ex(argc, &input) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument
should be an array");
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) ==
FAILURE) {
return;
}
ZVAL_LONG(return_value, 0);
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void
**)&entry, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos)) {
+ for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos);
+ zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void
**)&entry, &pos) == SUCCESS;
+ zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos)) {
if (Z_TYPE_PP(entry) == IS_ARRAY || Z_TYPE_PP(entry) ==
IS_OBJECT)
continue;
@@ -4189,34 +4183,28 @@
}
/* }}} */
-/* {{{ proto mixed array_product(array input)
+/* {{{ proto mixed array_product(array input) U
Returns the product of the array entries */
PHP_FUNCTION(array_product)
{
- zval **input,
+ zval *input,
**entry,
entry_n;
- int argc = ZEND_NUM_ARGS();
HashPosition pos;
double dval;
- if (argc != 1 || zend_get_parameters_ex(argc, &input) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument
should be an array");
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) ==
FAILURE) {
return;
}
- if (!zend_hash_num_elements(Z_ARRVAL_PP(input))) {
+ if (!zend_hash_num_elements(Z_ARRVAL_P(input))) {
RETURN_LONG(0);
}
ZVAL_LONG(return_value, 1);
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void
**)&entry, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos)) {
+ for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos);
+ zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void
**)&entry, &pos) == SUCCESS;
+ zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos)) {
if (Z_TYPE_PP(entry) == IS_ARRAY || Z_TYPE_PP(entry) ==
IS_OBJECT)
continue;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php