From: Stanislav Malyshev Date: Mon, 20 Nov 2000 12:35:08 +0000 (+0000) Subject: Add macro to replace value of zval with another value while preserving X-Git-Tag: php-4.0.4RC3~140 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35f4826fea9184e23ba9a9243a1fe78025c42bc7;p=php Add macro to replace value of zval with another value while preserving referencing structure --- diff --git a/Zend/zend.h b/Zend/zend.h index 7d91b42cdc..41e28fdc66 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -421,6 +421,21 @@ ZEND_API int zend_get_ini_entry(char *name, uint name_length, zval *contents); } \ INIT_PZVAL(&(zv)); +#define REPLACE_ZVAL_VALUE(ppzv_dest,pzv_src,copy) { \ + int is_ref,refcount; \ + \ + SEPARATE_ZVAL_IF_NOT_REF(ppzv_dest); \ + is_ref = (*ppzv_dest)->is_ref; \ + refcount = (*ppzv_dest)->refcount; \ + zval_dtor(*ppzv_dest); \ + **ppzv_dest = *pzv_src; \ + if(copy) { \ + zval_copy_ctor(*ppzv_dest); \ + } \ + (*ppzv_dest)->is_ref = is_ref; \ + (*ppzv_dest)->refcount = refcount; \ +} + #define ZEND_MAX_RESERVED_RESOURCES 2 #ifdef ZEND_WIN32