summaryrefslogtreecommitdiff
path: root/Zend/zend.h
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-07-23 16:02:51 +0000
committerZeev Suraski <zeev@php.net>1999-07-23 16:02:51 +0000
commit84aa8cce64c1c074a059fc74eb546cb028c32b5e (patch)
tree32ddbad2f32e801f56c4c2247a7b905833338606 /Zend/zend.h
parent33f30aee64d01e7b3f59ef087b2b250a7eb3a1e5 (diff)
downloadphp-git-84aa8cce64c1c074a059fc74eb546cb028c32b5e.tar.gz
* Add an API macro users can use to ensure an array member can be modifed
before they modify it. * Fix a bug and remove redundant code in convert_to_long() (booleans and resources weren't changing their types
Diffstat (limited to 'Zend/zend.h')
-rw-r--r--Zend/zend.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/Zend/zend.h b/Zend/zend.h
index 32bf64976c..0274c212dd 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -241,8 +241,23 @@ extern zend_utility_values zend_uv;
(z)->EA.is_ref = 0; \
(z)->EA.locks = 0;
-#define MAKE_STD_ZVAL(zv) \
+#define MAKE_STD_ZVAL(zv) \
zv = (zval *) emalloc(sizeof(zval)); \
INIT_PZVAL(zv);
+#define SEPARATE_ZVAL(ppzv) \
+ { \
+ zval *orig_ptr = *(ppzv); \
+ \
+ if (orig_ptr->refcount>1) { \
+ orig_ptr->refcount--; \
+ *(ppzv) = (zval *) emalloc(sizeof(zval)); \
+ **(ppzv) = *orig_ptr; \
+ zval_copy_ctor(*(ppzv)); \
+ (*(ppzv))->refcount=1; \
+ (*(ppzv))->EA.is_ref = 0; \
+ (*(ppzv))->EA.locks = 0; \
+ } \
+ }
+
#endif /* _ZEND_H */