Skip to content

Commit a1beac3

Browse files
committed
Zend: add const modifiers
1 parent a5ec2f0 commit a1beac3

File tree

8 files changed

+39
-39
lines changed

8 files changed

+39
-39
lines changed

Zend/zend_API.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */
14181418
}
14191419
/* }}} */
14201420

1421-
static zend_class_mutable_data *zend_allocate_mutable_data(zend_class_entry *class_type) /* {{{ */
1421+
static zend_class_mutable_data *zend_allocate_mutable_data(const zend_class_entry *class_type) /* {{{ */
14221422
{
14231423
zend_class_mutable_data *mutable_data;
14241424

@@ -1434,7 +1434,7 @@ static zend_class_mutable_data *zend_allocate_mutable_data(zend_class_entry *cla
14341434
}
14351435
/* }}} */
14361436

1437-
ZEND_API HashTable *zend_separate_class_constants_table(zend_class_entry *class_type) /* {{{ */
1437+
ZEND_API HashTable *zend_separate_class_constants_table(const zend_class_entry *class_type) /* {{{ */
14381438
{
14391439
zend_class_mutable_data *mutable_data;
14401440
HashTable *constants_table;
@@ -5208,7 +5208,7 @@ ZEND_API zend_result zend_update_static_property_stringl(zend_class_entry *scope
52085208
}
52095209
/* }}} */
52105210

5211-
ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, bool silent, zval *rv) /* {{{ */
5211+
ZEND_API zval *zend_read_property_ex(const zend_class_entry *scope, zend_object *object, zend_string *name, bool silent, zval *rv) /* {{{ */
52125212
{
52135213
zval *value;
52145214
const zend_class_entry *old_scope = EG(fake_scope);
@@ -5222,7 +5222,7 @@ ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zend_object *objec
52225222
}
52235223
/* }}} */
52245224

5225-
ZEND_API zval *zend_read_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, bool silent, zval *rv) /* {{{ */
5225+
ZEND_API zval *zend_read_property(const zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, bool silent, zval *rv) /* {{{ */
52265226
{
52275227
zval *value;
52285228
zend_string *str;

Zend/zend_API.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -448,12 +448,12 @@ ZEND_API void zend_declare_class_constant_string(zend_class_entry *ce, const cha
448448

449449
ZEND_API zend_result zend_update_class_constant(zend_class_constant *c, const zend_string *name, zend_class_entry *scope);
450450
ZEND_API zend_result zend_update_class_constants(zend_class_entry *class_type);
451-
ZEND_API HashTable *zend_separate_class_constants_table(zend_class_entry *class_type);
451+
ZEND_API HashTable *zend_separate_class_constants_table(const zend_class_entry *class_type);
452452

453-
static zend_always_inline HashTable *zend_class_constants_table(zend_class_entry *ce) {
453+
static zend_always_inline const HashTable *zend_class_constants_table(const zend_class_entry *ce) {
454454
if ((ce->ce_flags & ZEND_ACC_HAS_AST_CONSTANTS) && ZEND_MAP_PTR(ce->mutable_data)) {
455-
zend_class_mutable_data *mutable_data =
456-
(zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
455+
const zend_class_mutable_data *mutable_data =
456+
(const zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
457457
if (mutable_data && mutable_data->constants_table) {
458458
return mutable_data->constants_table;
459459
} else {
@@ -464,10 +464,10 @@ static zend_always_inline HashTable *zend_class_constants_table(zend_class_entry
464464
}
465465
}
466466

467-
static zend_always_inline zval *zend_class_default_properties_table(zend_class_entry *ce) {
467+
static zend_always_inline zval *zend_class_default_properties_table(const zend_class_entry *ce) {
468468
if ((ce->ce_flags & ZEND_ACC_HAS_AST_PROPERTIES) && ZEND_MAP_PTR(ce->mutable_data)) {
469-
zend_class_mutable_data *mutable_data =
470-
(zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
469+
const zend_class_mutable_data *mutable_data =
470+
(const zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
471471
return mutable_data->default_properties_table;
472472
} else {
473473
return ce->default_properties_table;
@@ -484,10 +484,10 @@ static zend_always_inline void zend_class_set_backed_enum_table(zend_class_entry
484484
}
485485
}
486486

487-
static zend_always_inline HashTable *zend_class_backed_enum_table(zend_class_entry *ce)
487+
static zend_always_inline HashTable *zend_class_backed_enum_table(const zend_class_entry *ce)
488488
{
489489
if (ZEND_MAP_PTR(ce->mutable_data) && ce->type == ZEND_USER_CLASS) {
490-
zend_class_mutable_data *mutable_data = (zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
490+
const zend_class_mutable_data *mutable_data = (const zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
491491
return mutable_data->backed_enum_table;
492492
} else {
493493
return ce->backed_enum_table;
@@ -514,8 +514,8 @@ ZEND_API zend_result zend_update_static_property_double(zend_class_entry *scope,
514514
ZEND_API zend_result zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value);
515515
ZEND_API zend_result zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_length);
516516

517-
ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, bool silent, zval *rv);
518-
ZEND_API zval *zend_read_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, bool silent, zval *rv);
517+
ZEND_API zval *zend_read_property_ex(const zend_class_entry *scope, zend_object *object, zend_string *name, bool silent, zval *rv);
518+
ZEND_API zval *zend_read_property(const zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, bool silent, zval *rv);
519519

520520
ZEND_API zval *zend_read_static_property_ex(zend_class_entry *scope, zend_string *name, bool silent);
521521
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, bool silent);

Zend/zend_attributes.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ ZEND_METHOD(NoDiscard, __construct)
246246
}
247247
}
248248

249-
static zend_attribute *get_attribute(HashTable *attributes, zend_string *lcname, uint32_t offset)
249+
static zend_attribute *get_attribute(const HashTable *attributes, const zend_string *lcname, uint32_t offset)
250250
{
251251
if (attributes) {
252252
zend_attribute *attr;
@@ -261,7 +261,7 @@ static zend_attribute *get_attribute(HashTable *attributes, zend_string *lcname,
261261
return NULL;
262262
}
263263

264-
static zend_attribute *get_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset)
264+
static zend_attribute *get_attribute_str(const HashTable *attributes, const char *str, size_t len, uint32_t offset)
265265
{
266266
if (attributes) {
267267
zend_attribute *attr;
@@ -276,27 +276,27 @@ static zend_attribute *get_attribute_str(HashTable *attributes, const char *str,
276276
return NULL;
277277
}
278278

279-
ZEND_API zend_attribute *zend_get_attribute(HashTable *attributes, zend_string *lcname)
279+
ZEND_API zend_attribute *zend_get_attribute(const HashTable *attributes, const zend_string *lcname)
280280
{
281281
return get_attribute(attributes, lcname, 0);
282282
}
283283

284-
ZEND_API zend_attribute *zend_get_attribute_str(HashTable *attributes, const char *str, size_t len)
284+
ZEND_API zend_attribute *zend_get_attribute_str(const HashTable *attributes, const char *str, size_t len)
285285
{
286286
return get_attribute_str(attributes, str, len, 0);
287287
}
288288

289-
ZEND_API zend_attribute *zend_get_parameter_attribute(HashTable *attributes, zend_string *lcname, uint32_t offset)
289+
ZEND_API zend_attribute *zend_get_parameter_attribute(const HashTable *attributes, const zend_string *lcname, uint32_t offset)
290290
{
291291
return get_attribute(attributes, lcname, offset + 1);
292292
}
293293

294-
ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset)
294+
ZEND_API zend_attribute *zend_get_parameter_attribute_str(const HashTable *attributes, const char *str, size_t len, uint32_t offset)
295295
{
296296
return get_attribute_str(attributes, str, len, offset + 1);
297297
}
298298

299-
ZEND_API zend_result zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope)
299+
ZEND_API zend_result zend_get_attribute_value(zval *ret, const zend_attribute *attr, uint32_t i, zend_class_entry *scope)
300300
{
301301
if (i >= attr->argc) {
302302
return FAILURE;
@@ -428,7 +428,7 @@ ZEND_API zend_string *zend_get_attribute_target_names(uint32_t flags)
428428
return smart_str_extract(&str);
429429
}
430430

431-
ZEND_API bool zend_is_attribute_repeated(HashTable *attributes, zend_attribute *attr)
431+
ZEND_API bool zend_is_attribute_repeated(const HashTable *attributes, const zend_attribute *attr)
432432
{
433433
zend_attribute *other;
434434

Zend/zend_attributes.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ typedef struct _zend_internal_attribute {
7777
zend_string* (*validator)(zend_attribute *attr, uint32_t target, zend_class_entry *scope);
7878
} zend_internal_attribute;
7979

80-
ZEND_API zend_attribute *zend_get_attribute(HashTable *attributes, zend_string *lcname);
81-
ZEND_API zend_attribute *zend_get_attribute_str(HashTable *attributes, const char *str, size_t len);
80+
ZEND_API zend_attribute *zend_get_attribute(const HashTable *attributes, const zend_string *lcname);
81+
ZEND_API zend_attribute *zend_get_attribute_str(const HashTable *attributes, const char *str, size_t len);
8282

83-
ZEND_API zend_attribute *zend_get_parameter_attribute(HashTable *attributes, zend_string *lcname, uint32_t offset);
84-
ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset);
83+
ZEND_API zend_attribute *zend_get_parameter_attribute(const HashTable *attributes, const zend_string *lcname, uint32_t offset);
84+
ZEND_API zend_attribute *zend_get_parameter_attribute_str(const HashTable *attributes, const char *str, size_t len, uint32_t offset);
8585

86-
ZEND_API zend_result zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope);
86+
ZEND_API zend_result zend_get_attribute_value(zval *ret, const zend_attribute *attr, uint32_t i, zend_class_entry *scope);
8787
ZEND_API zend_result zend_get_attribute_object(zval *out, zend_class_entry *attribute_ce, zend_attribute *attribute_data, zend_class_entry *scope, zend_string *filename);
8888

8989
ZEND_API zend_string *zend_get_attribute_target_names(uint32_t targets);
90-
ZEND_API bool zend_is_attribute_repeated(HashTable *attributes, zend_attribute *attr);
90+
ZEND_API bool zend_is_attribute_repeated(const HashTable *attributes, const zend_attribute *attr);
9191

9292
ZEND_API zend_internal_attribute *zend_mark_internal_attribute(zend_class_entry *ce);
9393
ZEND_API zend_internal_attribute *zend_internal_attribute_register(zend_class_entry *ce, uint32_t flags);

Zend/zend_constants.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ ZEND_API zend_constant *_zend_get_special_const(const char *name, size_t len) /*
251251
}
252252
/* }}} */
253253

254-
ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */
254+
ZEND_API bool zend_verify_const_access(const zend_class_constant *c, const zend_class_entry *scope) /* {{{ */
255255
{
256256
if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PUBLIC) {
257257
return 1;
@@ -312,9 +312,9 @@ ZEND_API zval *zend_get_constant(zend_string *name)
312312
return NULL;
313313
}
314314

315-
ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, zend_class_entry *scope, uint32_t flags)
315+
ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, const zend_class_entry *scope, uint32_t flags)
316316
{
317-
zend_class_entry *ce = NULL;
317+
const zend_class_entry *ce = NULL;
318318
zend_class_constant *c = NULL;
319319
zval *ret_constant = NULL;
320320

@@ -413,7 +413,7 @@ ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *
413413
return ret_constant;
414414
}
415415

416-
ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, uint32_t flags)
416+
ZEND_API zval *zend_get_constant_ex(zend_string *cname, const zend_class_entry *scope, uint32_t flags)
417417
{
418418
zend_constant *c;
419419
const char *colon;
@@ -492,7 +492,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
492492
return &c->value;
493493
}
494494

495-
static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_constant *c)
495+
static void* zend_hash_add_constant(HashTable *ht, zend_string *key, const zend_constant *c)
496496
{
497497
void *ret;
498498
zend_constant *copy = pemalloc(sizeof(zend_constant), ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT);

Zend/zend_constants.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ void clean_module_constants(int module_number);
8585
void free_zend_constant(zval *zv);
8686
void zend_startup_constants(void);
8787
void zend_register_standard_constants(void);
88-
ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *ce);
88+
ZEND_API bool zend_verify_const_access(const zend_class_constant *c, const zend_class_entry *ce);
8989
ZEND_API zval *zend_get_constant(zend_string *name);
9090
ZEND_API zend_constant *zend_get_constant_ptr(zend_string *name);
9191
ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len);
92-
ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, uint32_t flags);
93-
ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, zend_class_entry *scope, uint32_t flags);
92+
ZEND_API zval *zend_get_constant_ex(zend_string *name, const zend_class_entry *scope, uint32_t flags);
93+
ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, const zend_class_entry *scope, uint32_t flags);
9494
ZEND_API zend_constant *zend_register_bool_constant(const char *name, size_t name_len, bool bval, int flags, int module_number);
9595
ZEND_API zend_constant *zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number);
9696
ZEND_API zend_constant *zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number);

Zend/zend_execute_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ void zend_unset_timeout(void) /* {{{ */
16851685
}
16861686
/* }}} */
16871687

1688-
static ZEND_COLD void report_class_fetch_error(zend_string *class_name, uint32_t fetch_type)
1688+
static ZEND_COLD void report_class_fetch_error(const zend_string *class_name, uint32_t fetch_type)
16891689
{
16901690
if (fetch_type & ZEND_FETCH_CLASS_SILENT) {
16911691
return;

ext/reflection/php_reflection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4839,7 +4839,7 @@ ZEND_METHOD(ReflectionClass, getConstant)
48394839
{
48404840
reflection_object *intern;
48414841
zend_class_entry *ce;
4842-
HashTable *constants_table;
4842+
const HashTable *constants_table;
48434843
zend_class_constant *c;
48444844
zend_string *name, *key;
48454845

0 commit comments

Comments
 (0)