MAKE_STD_ZVAL and pointer address
| From: | Piotr Pokora | Date: | Wed, 25 Feb 2009 14:06:36 +0000 |
| Subject: | MAKE_STD_ZVAL and pointer address | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-6160@lists.php.net to get a copy of this message | ||
Hi!
I have quite simple function which returns zval and in some cases it's
invoked in a loop.
There is a problem with returned variable at PHP level. However it's
very random.
The C function is almost like this:
zval *_ret;
MAKE_STD_ZVAL(_ret);
some_function_which_sets_zval_type(_ret);
RETURN_ZVAL(_ret, 1, 1);
I added a debug statement (after MAKE_STD_ZVAL), which prints pointer
address (%p).
When this function is executed on PHP level in a loop, _ret address is
always the same.
Even if there are hundreds steps in a loop.
Is it normal?
I see new pointer is allocated (at new address) when I call
zval_add_ref(&_ret);
But I am not sure what is general purpose of zval_add_ref.
Any suggestion?
Piotras