summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
diff options
context:
space:
mode:
authorTyson Andre <tysonandre775@hotmail.com>2021-01-02 14:07:45 -0500
committerTyson Andre <tysonandre775@hotmail.com>2021-01-02 16:10:14 -0500
commitdfb9e03336fed7c4c07fb1a30a8be25cfbf546e4 (patch)
tree6ada3503f63bc7da91a6a1435264f1a6879775eb /Zend/zend_builtin_functions.c
parent64c753e7c823848b55553dee4bdf1a3336fbc0f5 (diff)
downloadphp-git-dfb9e03336fed7c4c07fb1a30a8be25cfbf546e4.tar.gz
Use Z_PARAM_OBJ macros when zval isn't needed
In some cases, like spl_object_id, the code is simpler but equally efficient after optimizations. In other cases, like get_mangled_object_vars(), the compiler can't infer that the object in the zval won't change. Closes GH-6567
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 5ec365c920..3760d42ac9 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -769,7 +769,6 @@ ZEND_FUNCTION(get_class_vars)
/* {{{ Returns an array of object properties */
ZEND_FUNCTION(get_object_vars)
{
- zval *obj;
zval *value;
HashTable *properties;
zend_string *key;
@@ -777,10 +776,9 @@ ZEND_FUNCTION(get_object_vars)
zend_ulong num_key;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_OBJECT(obj)
+ Z_PARAM_OBJ(zobj)
ZEND_PARSE_PARAMETERS_END();
- zobj = Z_OBJ_P(obj);
properties = zobj->handlers->get_properties(zobj);
if (properties == NULL) {
RETURN_EMPTY_ARRAY();
@@ -839,22 +837,22 @@ ZEND_FUNCTION(get_object_vars)
/* {{{ Returns an array of mangled object properties. Does not respect property visibility. */
ZEND_FUNCTION(get_mangled_object_vars)
{
- zval *obj;
+ zend_object *obj;
HashTable *properties;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_OBJECT(obj)
+ Z_PARAM_OBJ(obj)
ZEND_PARSE_PARAMETERS_END();
- properties = Z_OBJ_HT_P(obj)->get_properties(Z_OBJ_P(obj));
+ properties = obj->handlers->get_properties(obj);
if (!properties) {
ZVAL_EMPTY_ARRAY(return_value);
return;
}
properties = zend_proptable_to_symtable(properties,
- (Z_OBJCE_P(obj)->default_properties_count ||
- Z_OBJ_P(obj)->handlers != &std_object_handlers ||
+ (obj->ce->default_properties_count ||
+ obj->handlers != &std_object_handlers ||
GC_IS_RECURSIVE(properties)));
RETURN_ARR(properties);
}