TDJ>> Sorry, I wasn't clear. I mean ref_assign to be a C function, in my
TDJ>> extension.
Ah. Then you need to accept the first parameter by reference (this is
defined in ZEND_FE definition, put first_arg_force_ref as second
parameter). Then you get parameters the usual way (zend_get_parameters_ex,
etc.) and have to zval ** variables, something like this:
zval **dest, src;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &dest, &src)) {
WRONG_PARAM_COUNT;
}
Then if src wasn't reference, you need to separate it:
SEPARATE_ZVAL_TO_MAKE_IS_REF(src);
(*src)->refcount++;
This will also make src a reference.
Then you have to free old value of dest:
zval_ptr_dtor(dest);
Then assign:
*dest = *src;
I think this should be enough...
Note that refcount is increased before calling dtor - to avoid problems
with something like assign_ref($foo, $foo) (it's not wise to do this, but
this way it won't crash/produce garbage).
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED] http://www.zend.com/ +972-3-6139665 ext.109
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php