]> granicus.if.org Git - php/commitdiff
Add macro to replace value of zval with another value while preserving
authorStanislav Malyshev <stas@php.net>
Mon, 20 Nov 2000 12:35:08 +0000 (12:35 +0000)
committerStanislav Malyshev <stas@php.net>
Mon, 20 Nov 2000 12:35:08 +0000 (12:35 +0000)
referencing structure

Zend/zend.h

index 7d91b42cdcba7a2bcdbd1e4a4f0668234681144d..41e28fdc66ce603a6ebfecc1dbbae6f69d3b2710 100644 (file)
@@ -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