Skip to content

Commit 4f860a4

Browse files
committed
Avoding superfluous function call
1 parent af0c225 commit 4f860a4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ext/standard/var.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
626626
HashPosition pos;
627627
int i;
628628
zval nval, *nvalp;
629+
HashTable *propers;
629630

630631
ZVAL_NULL(&nval);
631632
nvalp = &nval;
@@ -651,7 +652,8 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
651652
smart_str_appendl(buf,"N;", 2);
652653
continue;
653654
}
654-
if (zend_hash_find(Z_OBJPROP_P(struc), Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, (void *) &d) == SUCCESS) {
655+
propers = Z_OBJPROP_P(struc);
656+
if (zend_hash_find(propers, Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, (void *) &d) == SUCCESS) {
655657
php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name));
656658
php_var_serialize_intern(buf, *d, var_hash TSRMLS_CC);
657659
} else {
@@ -663,15 +665,15 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
663665

664666
do {
665667
zend_mangle_property_name(&priv_name, &prop_name_length, ce->name, ce->name_length, Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS);
666-
if (zend_hash_find(Z_OBJPROP_P(struc), priv_name, prop_name_length + 1, (void *) &d) == SUCCESS) {
668+
if (zend_hash_find(propers, priv_name, prop_name_length + 1, (void *) &d) == SUCCESS) {
667669
php_var_serialize_string(buf, priv_name, prop_name_length);
668670
pefree(priv_name, ce->type & ZEND_INTERNAL_CLASS);
669671
php_var_serialize_intern(buf, *d, var_hash TSRMLS_CC);
670672
break;
671673
}
672674
pefree(priv_name, ce->type & ZEND_INTERNAL_CLASS);
673675
zend_mangle_property_name(&prot_name, &prop_name_length, "*", 1, Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS);
674-
if (zend_hash_find(Z_OBJPROP_P(struc), prot_name, prop_name_length + 1, (void *) &d) == SUCCESS) {
676+
if (zend_hash_find(propers, prot_name, prop_name_length + 1, (void *) &d) == SUCCESS) {
675677
php_var_serialize_string(buf, prot_name, prop_name_length);
676678
pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS);
677679
php_var_serialize_intern(buf, *d, var_hash TSRMLS_CC);

0 commit comments

Comments
 (0)