summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-06-06 14:22:10 +0300
committerDmitry Stogov <dmitry@zend.com>2019-06-06 14:22:10 +0300
commit741468d145dced618456ad4c4877571083eac3b2 (patch)
treebea03a527c4ba5482d27427f1106cc92057759ec /Zend
parentbe74ca497680ef544af1f650fe4717a3e0d0af67 (diff)
downloadphp-git-741468d145dced618456ad4c4877571083eac3b2.tar.gz
Use ZEND_ASSUME() to perform the following check only on "slow" path.
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_operators.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index 45c8305c34..b126e96611 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -287,7 +287,9 @@ static zend_always_inline void zend_tmp_string_release(zend_string *tmp) {
/* Like zval_get_string, but returns NULL if the conversion fails with an exception. */
static zend_always_inline zend_string *zval_try_get_string(zval *op) {
if (EXPECTED(Z_TYPE_P(op) == IS_STRING)) {
- return zend_string_copy(Z_STR_P(op));
+ zend_string *ret = zend_string_copy(Z_STR_P(op));
+ ZEND_ASSUME(ret != NULL);
+ return ret;
} else {
return zval_try_get_string_func(op);
}
@@ -296,8 +298,10 @@ static zend_always_inline zend_string *zval_try_get_string(zval *op) {
/* Like zval_get_tmp_string, but returns NULL if the conversion fails with an exception. */
static zend_always_inline zend_string *zval_try_get_tmp_string(zval *op, zend_string **tmp) {
if (EXPECTED(Z_TYPE_P(op) == IS_STRING)) {
+ zend_string *ret = Z_STR_P(op);
*tmp = NULL;
- return Z_STR_P(op);
+ ZEND_ASSUME(ret != NULL);
+ return ret;
} else {
return *tmp = zval_try_get_string_func(op);
}