helly Thu Mar 10 19:14:03 2005 EDT Modified files: /php-src/ext/standard array.c Log: - Do not touch return_valu's refcount or is_ref http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.292&r2=1.293&ty=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.292 php-src/ext/standard/array.c:1.293 --- php-src/ext/standard/array.c:1.292 Fri Mar 4 19:45:47 2005 +++ php-src/ext/standard/array.c Thu Mar 10 19:14:02 2005 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.292 2005/03/05 00:45:47 andrei Exp $ */ +/* $Id: array.c,v 1.293 2005/03/11 00:14:02 helly Exp $ */ #include "php.h" #include "php_ini.h" @@ -783,8 +783,7 @@ RETURN_FALSE; } - *return_value = **entry; - zval_copy_ctor(return_value); + RETURN_ZVAL(*entry, 1, 0); } } /* }}} */ @@ -811,8 +810,7 @@ RETURN_FALSE; } - *return_value = **entry; - zval_copy_ctor(return_value); + RETURN_ZVAL(*entry, 1, 0); } } /* }}} */ @@ -839,8 +837,7 @@ RETURN_FALSE; } - *return_value = **entry; - zval_copy_ctor(return_value); + RETURN_ZVAL(*entry, 1, 0); } } /* }}} */ @@ -867,8 +864,7 @@ RETURN_FALSE; } - *return_value = **entry; - zval_copy_ctor(return_value); + RETURN_ZVAL(*entry, 1, 0); } } /* }}} */ @@ -891,8 +887,7 @@ if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) { RETURN_FALSE; } - *return_value = **entry; - zval_copy_ctor(return_value); + RETURN_ZVAL(*entry, 1, 0); } /* }}} */ @@ -946,8 +941,7 @@ WRONG_PARAM_COUNT; } if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 0, (void **) &result TSRMLS_CC) == SUCCESS) { - *return_value = **result; - zval_copy_ctor(return_value); + RETVAL_ZVAL(*result, 1, 0); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain atleast one element"); RETURN_FALSE; @@ -971,8 +965,7 @@ } } - *return_value = **min; - zval_copy_ctor(return_value); + RETVAL_ZVAL(*min, 1, 0); efree(args); } @@ -998,8 +991,7 @@ WRONG_PARAM_COUNT; } if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 1, (void **) &result TSRMLS_CC) == SUCCESS) { - *return_value = **result; - zval_copy_ctor(return_value); + RETVAL_ZVAL(*result, 1, 0); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain atleast one element"); RETURN_FALSE; @@ -1023,9 +1015,7 @@ } } - *return_value = **max; - zval_copy_ctor(return_value); - + RETVAL_ZVAL(*max, 1, 0); efree(args); } } @@ -1947,9 +1937,7 @@ else zend_hash_internal_pointer_reset(Z_ARRVAL_PP(stack)); zend_hash_get_current_data(Z_ARRVAL_PP(stack), (void **)&val); - *return_value = **val; - zval_copy_ctor(return_value); - INIT_PZVAL(return_value); + RETVAL_ZVAL(*val, 1, 0); /* Delete the first or last value */ zend_hash_get_current_key_ex(Z_ARRVAL_PP(stack), &key, &key_len, &index, 0, NULL); @@ -2605,8 +2593,7 @@ do_pad = (input_size >= pad_size_abs) ? 0 : 1; /* Copy the original array */ - *return_value = **input; - zval_copy_ctor(return_value); + RETVAL_ZVAL(*input, 1, 0); /* If no need to pad, no need to continue */ if (!do_pad) { @@ -2771,8 +2758,7 @@ } /* copy the argument array */ - *return_value = **array; - zval_copy_ctor(return_value); + RETVAL_ZVAL(*array, 1, 0); if (target_hash->nNumOfElements <= 1) { /* nothing to do */ return; @@ -3003,8 +2989,7 @@ } /* copy the argument array */ - *return_value = **args[0]; - zval_copy_ctor(return_value); + RETVAL_ZVAL(*args[0], 1, 0); if ((behavior & INTERSECT_NORMAL) && data_compare_type == INTERSECT_COMP_DATA_USER) { /* array_uintersect() */ @@ -3384,8 +3369,7 @@ } /* copy the argument array */ - *return_value = **args[0]; - zval_copy_ctor(return_value); + RETVAL_ZVAL(*args[0], 1, 0); if (behavior == DIFF_NORMAL && data_compare_type == DIFF_COMP_DATA_USER) { /* array_udiff() */ @@ -3966,8 +3950,7 @@ if (zend_hash_num_elements(htbl) == 0) { if (result) { - *return_value = *result; - zval_copy_ctor(return_value); + RETVAL_ZVAL(result, 1, 0); } return; } @@ -4005,9 +3988,7 @@ zend_hash_move_forward_ex(htbl, &pos); } - *return_value = *result; - zval_copy_ctor(return_value); - zval_ptr_dtor(&result); + RETVAL_ZVAL(result, 0, 1); } /* }}} */ @@ -4164,8 +4145,7 @@ /* Short-circuit: if no callback and only one array, just return it. */ if (Z_TYPE_P(callback) == IS_NULL && ZEND_NUM_ARGS() == 2) { - *return_value = *args[1]; - zval_copy_ctor(return_value); + RETVAL_ZVAL(args[1], 1, 0); efree(array_len); efree(array_pos); efree(args);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php