com php-src: Fixed SEPARATE_ZVAL() to support objec ts and resources: Zend/zend.h

From: Date: Fri, 28 Feb 2014 07:21:15 +0000
Subject: com php-src: Fixed SEPARATE_ZVAL() to support objec ts and resources: Zend/zend.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-77868@lists.php.net to get a copy of this message
Commit: 5b5367ddbb1da19ac0b88a5736cec46cab9b0bc2 Author: Dmitry Stogov <dmitry@zend.com> Fri, 28 Feb 2014 11:21:15 +0400 Parents: 54095e8c564e1a5ddb4457cfa47874523e6eda6e Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5b5367ddbb1da19ac0b88a5736cec46cab9b0bc2 Log: Fixed SEPARATE_ZVAL() to support objects and resources Changed paths: M Zend/zend.h Diff: diff --git a/Zend/zend.h b/Zend/zend.h index b62a022..1ac7914 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -680,15 +680,20 @@ END_EXTERN_C() Z_UNSET_ISREF_P(z); \ } while (0) -// TODO: support objects and resources??? -#define SEPARATE_ZVAL(zv) do { \ - if (Z_REFCOUNTED_P(zv)) { \ - if (Z_REFCOUNT_P(zv) > 1) { \ - Z_DELREF_P(zv); \ - zval_copy_ctor(zv); \ - Z_SET_REFCOUNT_P(zv, 1); \ - } \ - } \ +// TODO: support objects and resources in more optimal way ??? +#define SEPARATE_ZVAL(zv) do { \ + if (Z_REFCOUNTED_P(zv)) { \ + if (Z_REFCOUNT_P(zv) > 1) { \ + if (Z_TYPE_P(zv) == IS_OBJECT || \ + Z_TYPE_P(zv) == IS_RESOURCE) { \ + Z_ADDREF_P(zv); \ + } else { \ + Z_DELREF_P(zv); \ + zval_copy_ctor(zv); \ + Z_SET_REFCOUNT_P(zv, 1); \ + } \ + } \ + } \ } while (0) #define SEPARATE_ZVAL_IF_NOT_REF(zv) \

« previous php.cvs (#77868) next »