com php-src: Fixed refcounting: Zend/zend.h
| From: | Dmitry Stogov | Date: | Fri, 07 Mar 2014 11:58:09 +0000 |
| Subject: | com php-src: Fixed refcounting: Zend/zend.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77686@lists.php.net to get a copy of this message | ||
Commit: 6d67dd3103ce8ac0b07981131311f6b29754a518
Author: Dmitry Stogov <dmitry@zend.com> Fri, 7 Mar 2014 15:58:09 +0400
Parents: 5edbe296ef5c8dc4570ecfb5a8b38f88af584129
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6d67dd3103ce8ac0b07981131311f6b29754a518
Log:
Fixed refcounting
Changed paths:
M Zend/zend.h
Diff:
diff --git a/Zend/zend.h b/Zend/zend.h
index e2aaf1a..bb883b4 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -699,7 +699,7 @@ END_EXTERN_C()
ZVAL_DUP(_zv, Z_REFVAL_P(_zv)); \
} else if (Z_TYPE_P(_zv) == IS_OBJECT ||\
Z_TYPE_P(_zv) == IS_RESOURCE) { \
- Z_ADDREF_P(_zv); \
+ /*Z_ADDREF_P(_zv);*/ \
} else { \
Z_DELREF_P(_zv); \
zval_copy_ctor(_zv); \
@@ -734,10 +734,17 @@ END_EXTERN_C()
#define SEPARATE_ZVAL_TO_MAKE_IS_REF(zv) do { \
zval *__zv = (zv); \
if (!Z_ISREF_P(__zv)) { \
- zval ref; \
- ZVAL_COPY_VALUE(&ref, __zv); \
- SEPARATE_ZVAL(&ref); \
- ZVAL_NEW_REF(__zv, &ref); \
+ if (!Z_REFCOUNTED_P(__zv) || \
+ Z_REFCOUNT_P(__zv) == 1) { \
+ ZVAL_NEW_REF(__zv, __zv); \
+ } else if (Z_TYPE_P(__zv) == IS_OBJECT || \
+ Z_TYPE_P(__zv) == IS_RESOURCE) { \
+ } else { \
+ zval ref; \
+ ZVAL_COPY_VALUE(&ref, __zv); \
+ SEPARATE_ZVAL(&ref); \
+ ZVAL_NEW_REF(__zv, &ref); \
+ } \
} \
} while (0)