From: Andi Gutmans Date: Tue, 16 Nov 1999 18:47:47 +0000 (+0000) Subject: - Initial support for Thies' idea of passing functions a flag telling them X-Git-Tag: ZEND_OPTIMIZER_B1~56 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7239aad9c43b1e40bd8704adf7c42c4b3684ba31;p=php - Initial support for Thies' idea of passing functions a flag telling them they don't need to return a value. Adjusted reset() to work with this. It is a bit problematic because if internal functions don't look at the flag and still return a value orginally this leaked. So I free the value in any case, which kind of makes the speed gain a bit smaller --- diff --git a/ext/standard/array.c b/ext/standard/array.c index cf8114a2b6..6381f64888 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -574,10 +574,12 @@ PHP_FUNCTION(reset) if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) { return; } - - *return_value = **entry; - pval_copy_constructor(return_value); - INIT_PZVAL(return_value); /* XXX is this needed? */ + + if (used_return_value) { + *return_value = **entry; + pval_copy_constructor(return_value); + /* INIT_PZVAL(return_value); XXX is this needed? - No! :) */ + } } PHP_FUNCTION(current)