1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Zend: add const modifiers (#19571)

This commit is contained in:
Gina Peter Banyard
2026-03-23 10:52:28 +00:00
committed by GitHub
parent 00c0a9ba30
commit be1ae8ef6f
4 changed files with 17 additions and 17 deletions

View File

@@ -445,10 +445,10 @@ ZEND_API zend_result zend_update_class_constant(zend_class_constant *c, const ze
ZEND_API zend_result zend_update_class_constants(zend_class_entry *class_type);
ZEND_API HashTable *zend_separate_class_constants_table(const zend_class_entry *class_type);
static zend_always_inline HashTable *zend_class_constants_table(zend_class_entry *ce) {
static zend_always_inline const HashTable *zend_class_constants_table(const zend_class_entry *ce) {
if ((ce->ce_flags & ZEND_ACC_HAS_AST_CONSTANTS) && ZEND_MAP_PTR(ce->mutable_data)) {
zend_class_mutable_data *mutable_data =
(zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
const zend_class_mutable_data *mutable_data =
(const zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
if (mutable_data && mutable_data->constants_table) {
return mutable_data->constants_table;
} else {
@@ -459,10 +459,10 @@ static zend_always_inline HashTable *zend_class_constants_table(zend_class_entry
}
}
static zend_always_inline zval *zend_class_default_properties_table(zend_class_entry *ce) {
static zend_always_inline zval *zend_class_default_properties_table(const zend_class_entry *ce) {
if ((ce->ce_flags & ZEND_ACC_HAS_AST_PROPERTIES) && ZEND_MAP_PTR(ce->mutable_data)) {
zend_class_mutable_data *mutable_data =
(zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
const zend_class_mutable_data *mutable_data =
(const zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
return mutable_data->default_properties_table;
} else {
return ce->default_properties_table;
@@ -479,10 +479,10 @@ static zend_always_inline void zend_class_set_backed_enum_table(zend_class_entry
}
}
static zend_always_inline HashTable *zend_class_backed_enum_table(zend_class_entry *ce)
static zend_always_inline HashTable *zend_class_backed_enum_table(const zend_class_entry *ce)
{
if (ZEND_MAP_PTR(ce->mutable_data) && ce->type == ZEND_USER_CLASS) {
zend_class_mutable_data *mutable_data = (zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
const zend_class_mutable_data *mutable_data = (const zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
return mutable_data->backed_enum_table;
} else {
return ce->backed_enum_table;

View File

@@ -251,7 +251,7 @@ ZEND_API zend_constant *_zend_get_special_const(const char *name, size_t len) /*
}
/* }}} */
ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */
ZEND_API bool zend_verify_const_access(const zend_class_constant *c, const zend_class_entry *scope) /* {{{ */
{
if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PUBLIC) {
return 1;
@@ -312,9 +312,9 @@ ZEND_API zval *zend_get_constant(zend_string *name)
return NULL;
}
ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, zend_class_entry *scope, uint32_t flags)
ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, const zend_class_entry *scope, uint32_t flags)
{
zend_class_entry *ce = NULL;
const zend_class_entry *ce = NULL;
zend_class_constant *c = NULL;
zval *ret_constant = NULL;
@@ -413,7 +413,7 @@ failure:
return ret_constant;
}
ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, uint32_t flags)
ZEND_API zval *zend_get_constant_ex(zend_string *cname, const zend_class_entry *scope, uint32_t flags)
{
zend_constant *c;
const char *colon;
@@ -495,7 +495,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
return &c->value;
}
static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_constant *c)
static void* zend_hash_add_constant(HashTable *ht, zend_string *key, const zend_constant *c)
{
void *ret;
zend_constant *copy = pemalloc(sizeof(zend_constant), ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT);

View File

@@ -85,12 +85,12 @@ void clean_module_constants(int module_number);
void free_zend_constant(zval *zv);
void zend_startup_constants(void);
void zend_register_standard_constants(void);
ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *ce);
ZEND_API bool zend_verify_const_access(const zend_class_constant *c, const zend_class_entry *ce);
ZEND_API zval *zend_get_constant(zend_string *name);
ZEND_API zend_constant *zend_get_constant_ptr(zend_string *name);
ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len);
ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, uint32_t flags);
ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, zend_class_entry *scope, uint32_t flags);
ZEND_API zval *zend_get_constant_ex(zend_string *name, const zend_class_entry *scope, uint32_t flags);
ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, const zend_class_entry *scope, uint32_t flags);
ZEND_API zend_constant *zend_register_bool_constant(const char *name, size_t name_len, bool bval, int flags, int module_number);
ZEND_API zend_constant *zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number);
ZEND_API zend_constant *zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number);

View File

@@ -4820,7 +4820,7 @@ ZEND_METHOD(ReflectionClass, getConstant)
{
reflection_object *intern;
zend_class_entry *ce;
HashTable *constants_table;
const HashTable *constants_table;
zend_class_constant *c;
zend_string *name, *key;