From ef77608abc63a7517763ee8510c1615d6f8f4f8c Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 15 Jan 2023 16:37:53 +0000 Subject: [PATCH] Add some const qualifiers and better return types I initially wanted to add them to the zend_strings but because they are used in zend_hash_find() which might modify the hash field. --- Zend/zend_object_handlers.c | 8 ++++---- Zend/zend_object_handlers.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 923dce5972969..6c828e6697402 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -488,7 +488,7 @@ ZEND_API zend_property_info *zend_get_property_info(const zend_class_entry *ce, } /* }}} */ -ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, bool is_dynamic) /* {{{ */ +ZEND_API zend_result zend_check_property_access(const zend_object *zobj, zend_string *prop_info_name, bool is_dynamic) /* {{{ */ { zend_property_info *property_info; const char *class_name = NULL; @@ -1228,9 +1228,9 @@ static zend_never_inline zend_function *zend_get_parent_private_method(zend_clas /* Ensures that we're allowed to call a protected method. */ -ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ +ZEND_API bool zend_check_protected(const zend_class_entry *ce, const zend_class_entry *scope) /* {{{ */ { - zend_class_entry *fbc_scope = ce; + const zend_class_entry *fbc_scope = ce; /* Is the context that's calling the function, the same as one of * the function's parents? @@ -1255,7 +1255,7 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) } /* }}} */ -ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, int is_static) /* {{{ */ +ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce, zend_string *method_name, bool is_static) /* {{{ */ { size_t mname_len; zend_op_array *func; diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 4d78c70cf20a4..090e561534c21 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -233,11 +233,11 @@ ZEND_API HashTable *zend_std_build_object_properties_array(zend_object *zobj); * Only objects with the same identity will be considered equal. */ ZEND_API int zend_objects_not_comparable(zval *o1, zval *o2); -ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); +ZEND_API bool zend_check_protected(const zend_class_entry *ce, const zend_class_entry *scope); -ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, bool is_dynamic); +ZEND_API zend_result zend_check_property_access(const zend_object *zobj, zend_string *prop_info_name, bool is_dynamic); -ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, int is_static); +ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce, zend_string *method_name, bool is_static); ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *member);