summaryrefslogtreecommitdiff
path: root/Zend/zend_string.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-04-03 15:26:23 +0400
committerDmitry Stogov <dmitry@zend.com>2014-04-03 15:26:23 +0400
commit76cc99fe60d1e446a0250b4d778f02bcdbd7fc09 (patch)
tree51b80d5b6c401bebee6c01d28423018a10edb232 /Zend/zend_string.h
parentd8099d0468426dbee59f540048376653535270ce (diff)
downloadphp-git-76cc99fe60d1e446a0250b4d778f02bcdbd7fc09.tar.gz
Refactored ZVAL flags usage to simplify various checks (e.g. Z_REFCOUNTED(), candidate for GC, etc)
Diffstat (limited to 'Zend/zend_string.h')
-rw-r--r--Zend/zend_string.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/Zend/zend_string.h b/Zend/zend_string.h
index 0687700be8..3072afd322 100644
--- a/Zend/zend_string.h
+++ b/Zend/zend_string.h
@@ -98,10 +98,14 @@ static zend_always_inline zend_string *zend_str_alloc(int len, int persistent)
zend_string *ret = pemalloc(sizeof(zend_string) + len, persistent);
GC_REFCOUNT(ret) = 1;
-// TODO use one assignment ???
+#if 1
+ /* optimized single assignment */
+ GC_TYPE_INFO(ret) = IS_STRING | ((persistent ? IS_STR_PERSISTENT : 0) << 8);
+#else
GC_TYPE(ret) = IS_STRING;
GC_FLAGS(ret) = (persistent ? IS_STR_PERSISTENT : 0);
GC_INFO(ret) = 0;
+#endif
ret->h = 0;
ret->len = len;
return ret;