+#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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php