Skip to content

Commit 6556601

Browse files
authoredJan 16, 2023
Add some const qualifiers and better return types to zend_object_handlers.h (#10330)
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.
1 parent da550e7 commit 6556601

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed
 

‎Zend/zend_object_handlers.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ ZEND_API zend_property_info *zend_get_property_info(const zend_class_entry *ce,
488488
}
489489
/* }}} */
490490

491-
ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, bool is_dynamic) /* {{{ */
491+
ZEND_API zend_result zend_check_property_access(const zend_object *zobj, zend_string *prop_info_name, bool is_dynamic) /* {{{ */
492492
{
493493
zend_property_info *property_info;
494494
const char *class_name = NULL;
@@ -1228,9 +1228,9 @@ static zend_never_inline zend_function *zend_get_parent_private_method(zend_clas
12281228

12291229
/* Ensures that we're allowed to call a protected method.
12301230
*/
1231-
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */
1231+
ZEND_API bool zend_check_protected(const zend_class_entry *ce, const zend_class_entry *scope) /* {{{ */
12321232
{
1233-
zend_class_entry *fbc_scope = ce;
1233+
const zend_class_entry *fbc_scope = ce;
12341234

12351235
/* Is the context that's calling the function, the same as one of
12361236
* the function's parents?
@@ -1255,7 +1255,7 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope)
12551255
}
12561256
/* }}} */
12571257

1258-
ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, int is_static) /* {{{ */
1258+
ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce, zend_string *method_name, bool is_static) /* {{{ */
12591259
{
12601260
size_t mname_len;
12611261
zend_op_array *func;

‎Zend/zend_object_handlers.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,11 @@ ZEND_API HashTable *zend_std_build_object_properties_array(zend_object *zobj);
231231
* Only objects with the same identity will be considered equal. */
232232
ZEND_API int zend_objects_not_comparable(zval *o1, zval *o2);
233233

234-
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
234+
ZEND_API bool zend_check_protected(const zend_class_entry *ce, const zend_class_entry *scope);
235235

236-
ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, bool is_dynamic);
236+
ZEND_API zend_result zend_check_property_access(const zend_object *zobj, zend_string *prop_info_name, bool is_dynamic);
237237

238-
ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend_string *method_name, int is_static);
238+
ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce, zend_string *method_name, bool is_static);
239239

240240
ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *member);
241241

0 commit comments

Comments
 (0)
Please sign in to comment.