Re: [PATCH] Converting accesses to refcount and is_ref to macros

From: Date: Sat, 14 Jul 2007 08:50:11 +0000
Subject: Re: [PATCH] Converting accesses to refcount and is_ref to macros
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-30920@lists.php.net to get a copy of this message
+#define ZVAL_ADDREF(pz) ++(pz)->refcount; +#define ZVAL_ADDREF_M(pz, count) (pz)->refcount += (count); "_M"? Doesn't seem to be self-descriptive.. +#define ZVAL_ADDREF_NP(pz) ++(pz).refcount; "_NP" ? "not pointer" ? Most of the macros in the engine are called this way: <macro>() - operates on zval struct <macro>_P() - operates on pointer to zval <macro>_PP() - operates on pointer to pointer It would be good to conform this de-facto standard. +#define ZVAL_MARKREF(pz) (pz)->is_ref = 1; +#define ZVAL_UNMARKREF(pz) (pz)->is_ref = 0; +#define ZVAL_SETISREF(pz, isrefv) (pz)->is_ref = (isrefv); So do they MARK or SET? We should choose one of them to be consistent. I personally prefer SET. On 14.07.2007 04:15, David Wang wrote:
This patch is a simple, albeit widespread change that converts access to zval.refcount, zval.is_ref, _object_store.refcount to macros. There is no functional change to the code, but this will make it easier to implement a garbage collector in the future. This patch was too large to attach to the e-mail message. It is available at: http://web.pdx.edu/~way/macropatch.diff.txt Yiduo (David) Wang
-- Wbr, Antony Dovgal

« previous php.internals (#30920) next »