Skip to content

Commit ccda8b1

Browse files
committed
zend_API.c: add const qualifiers
1 parent fe74aa1 commit ccda8b1

File tree

3 files changed

+54
-54
lines changed

3 files changed

+54
-54
lines changed

Zend/zend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ typedef struct {
442442
BEGIN_EXTERN_C()
443443
ZEND_API void zend_save_error_handling(zend_error_handling *current);
444444
ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling, zend_class_entry *exception_class, zend_error_handling *current);
445-
ZEND_API void zend_restore_error_handling(zend_error_handling *saved);
445+
ZEND_API void zend_restore_error_handling(const zend_error_handling *saved);
446446
ZEND_API void zend_begin_record_errors(void);
447447
ZEND_API void zend_emit_recorded_errors(void);
448448
ZEND_API void zend_emit_recorded_errors_ex(uint32_t num_errors, zend_error_info **errors);

Zend/zend_API.c

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ ZEND_API ZEND_COLD void zend_wrong_param_count(void) /* {{{ */
8585
}
8686
/* }}} */
8787

88-
ZEND_API ZEND_COLD void zend_wrong_property_read(zval *object, zval *property)
88+
ZEND_API ZEND_COLD void zend_wrong_property_read(const zval *object, zval *property)
8989
{
9090
zend_string *tmp_property_name;
9191
zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name);
@@ -225,7 +225,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error(uint32_t
225225
}
226226
/* }}} */
227227

228-
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_error(int error_code, uint32_t num, char *name, zend_expected_type expected_type, zval *arg) /* {{{ */
228+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_error(int error_code, uint32_t num, char *name, zend_expected_type expected_type, const zval *arg) /* {{{ */
229229
{
230230
switch (error_code) {
231231
case ZPP_ERROR_WRONG_CALLBACK:
@@ -266,7 +266,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_error(int error_code,
266266
}
267267
/* }}} */
268268

269-
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(uint32_t num, zend_expected_type expected_type, zval *arg) /* {{{ */
269+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(uint32_t num, zend_expected_type expected_type, const zval *arg) /* {{{ */
270270
{
271271
static const char * const expected_error[] = {
272272
Z_EXPECTED_TYPES(Z_EXPECTED_TYPE_STR)
@@ -287,7 +287,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(uint32_t n
287287
}
288288
/* }}} */
289289

290-
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(uint32_t num, const char *name, zval *arg) /* {{{ */
290+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(uint32_t num, const char *name, const zval *arg) /* {{{ */
291291
{
292292
if (EG(exception)) {
293293
return;
@@ -297,7 +297,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(uint32_t
297297
}
298298
/* }}} */
299299

300-
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_null_error(uint32_t num, const char *name, zval *arg) /* {{{ */
300+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_null_error(uint32_t num, const char *name, const zval *arg) /* {{{ */
301301
{
302302
if (EG(exception)) {
303303
return;
@@ -307,7 +307,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_null_error(u
307307
}
308308
/* }}} */
309309

310-
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_long_error(uint32_t num, const char *name, zval *arg) /* {{{ */
310+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_long_error(uint32_t num, const char *name, const zval *arg) /* {{{ */
311311
{
312312
if (EG(exception)) {
313313
return;
@@ -317,7 +317,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_long_error(u
317317
}
318318
/* }}} */
319319

320-
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_long_or_null_error(uint32_t num, const char *name, zval *arg) /* {{{ */
320+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_long_or_null_error(uint32_t num, const char *name, const zval *arg) /* {{{ */
321321
{
322322
if (EG(exception)) {
323323
return;
@@ -327,7 +327,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_long_or_null
327327
}
328328
/* }}} */
329329

330-
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_string_error(uint32_t num, const char *name, zval *arg) /* {{{ */
330+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_string_error(uint32_t num, const char *name, const zval *arg) /* {{{ */
331331
{
332332
if (EG(exception)) {
333333
return;
@@ -337,7 +337,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_string_error
337337
}
338338
/* }}} */
339339

340-
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_string_or_null_error(uint32_t num, const char *name, zval *arg) /* {{{ */
340+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_string_or_null_error(uint32_t num, const char *name, const zval *arg) /* {{{ */
341341
{
342342
if (EG(exception)) {
343343
return;
@@ -1374,7 +1374,7 @@ ZEND_API zend_result zend_parse_method_parameters_ex(int flags, uint32_t num_arg
13741374

13751375
/* This function should be called after the constructor has been called
13761376
* because it may call __set from the uninitialized object otherwise. */
1377-
ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */
1377+
ZEND_API void zend_merge_properties(const zval *obj, const HashTable *properties) /* {{{ */
13781378
{
13791379
zend_object *zobj = Z_OBJ_P(obj);
13801380
zend_object_write_property_t write_property = zobj->handlers->write_property;
@@ -1396,7 +1396,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */
13961396
}
13971397
/* }}} */
13981398

1399-
static zend_class_mutable_data *zend_allocate_mutable_data(zend_class_entry *class_type) /* {{{ */
1399+
static zend_class_mutable_data *zend_allocate_mutable_data(const zend_class_entry *class_type) /* {{{ */
14001400
{
14011401
zend_class_mutable_data *mutable_data;
14021402

@@ -1412,7 +1412,7 @@ static zend_class_mutable_data *zend_allocate_mutable_data(zend_class_entry *cla
14121412
}
14131413
/* }}} */
14141414

1415-
ZEND_API HashTable *zend_separate_class_constants_table(zend_class_entry *class_type) /* {{{ */
1415+
ZEND_API HashTable *zend_separate_class_constants_table(const zend_class_entry *class_type) /* {{{ */
14161416
{
14171417
zend_class_mutable_data *mutable_data;
14181418
HashTable *constants_table;
@@ -1452,7 +1452,7 @@ ZEND_API HashTable *zend_separate_class_constants_table(zend_class_entry *class_
14521452
return constants_table;
14531453
}
14541454

1455-
static zend_result update_property(zval *val, zend_property_info *prop_info) {
1455+
static zend_result update_property(zval *val, const zend_property_info *prop_info) {
14561456
if (ZEND_TYPE_IS_SET(prop_info->type)) {
14571457
zval tmp;
14581458

@@ -1713,7 +1713,7 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti
17131713
}
17141714
/* }}} */
17151715

1716-
ZEND_API void object_properties_load(zend_object *object, HashTable *properties) /* {{{ */
1716+
ZEND_API void object_properties_load(zend_object *object, const HashTable *properties) /* {{{ */
17171717
{
17181718
zval *prop, tmp;
17191719
zend_string *key;
@@ -2769,7 +2769,7 @@ static void zend_check_magic_method_no_return_type(
27692769
}
27702770
}
27712771

2772-
ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, const zend_function *fptr, zend_string *lcname, int error_type) /* {{{ */
2772+
ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, const zend_function *fptr, const zend_string *lcname, int error_type) /* {{{ */
27732773
{
27742774
if (ZSTR_VAL(lcname)[0] != '_'
27752775
|| ZSTR_VAL(lcname)[1] != '_') {
@@ -2866,7 +2866,7 @@ ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce,
28662866
}
28672867
/* }}} */
28682868

2869-
ZEND_API void zend_add_magic_method(zend_class_entry *ce, zend_function *fptr, zend_string *lcname)
2869+
ZEND_API void zend_add_magic_method(zend_class_entry *ce, zend_function *fptr, const zend_string *lcname)
28702870
{
28712871
if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') {
28722872
/* pass */
@@ -3283,7 +3283,7 @@ static void clean_module_classes(int module_number) /* {{{ */
32833283
/* Child classes may reuse structures from parent classes, so destroy in reverse order. */
32843284
Bucket *bucket;
32853285
ZEND_HASH_REVERSE_FOREACH_BUCKET(EG(class_table), bucket) {
3286-
zend_class_entry *ce = Z_CE(bucket->val);
3286+
const zend_class_entry *ce = Z_CE(bucket->val);
32873287
if (ce->type == ZEND_INTERNAL_CLASS && ce->info.internal.module->module_number == module_number) {
32883288
zend_hash_del_bucket(EG(class_table), bucket);
32893289
}
@@ -3294,8 +3294,8 @@ static void clean_module_classes(int module_number) /* {{{ */
32943294

32953295
static int clean_module_function(zval *el, void *arg) /* {{{ */
32963296
{
3297-
zend_function *fe = (zend_function *) Z_PTR_P(el);
3298-
zend_module_entry *module = (zend_module_entry *) arg;
3297+
const zend_function *fe = (zend_function *) Z_PTR_P(el);
3298+
const zend_module_entry *module = arg;
32993299
if (fe->common.type == ZEND_INTERNAL_FUNCTION && fe->internal_function.module == module) {
33003300
return ZEND_HASH_APPLY_REMOVE;
33013301
} else {
@@ -3383,7 +3383,7 @@ ZEND_API void zend_activate_modules(void) /* {{{ */
33833383
zend_module_entry **p = module_request_startup_handlers;
33843384

33853385
while (*p) {
3386-
zend_module_entry *module = *p;
3386+
const zend_module_entry *module = *p;
33873387

33883388
if (module->request_startup_func(module->type, module->module_number)==FAILURE) {
33893389
zend_error(E_WARNING, "request_startup() for %s module failed", module->name);
@@ -3412,7 +3412,7 @@ ZEND_API void zend_deactivate_modules(void) /* {{{ */
34123412
zend_module_entry **p = module_request_shutdown_handlers;
34133413

34143414
while (*p) {
3415-
zend_module_entry *module = *p;
3415+
const zend_module_entry *module = *p;
34163416
zend_try {
34173417
module->request_shutdown_func(module->type, module->module_number);
34183418
} zend_end_try();
@@ -3461,7 +3461,7 @@ ZEND_API void zend_post_deactivate_modules(void) /* {{{ */
34613461
zend_module_entry **p = module_post_deactivate_handlers;
34623462

34633463
while (*p) {
3464-
zend_module_entry *module = *p;
3464+
const zend_module_entry *module = *p;
34653465

34663466
module->post_deactivate_func();
34673467
p++;
@@ -3477,7 +3477,7 @@ ZEND_API int zend_next_free_module(void) /* {{{ */
34773477
}
34783478
/* }}} */
34793479

3480-
static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, uint32_t ce_flags) /* {{{ */
3480+
static zend_class_entry *do_register_internal_class(const zend_class_entry *orig_class_entry, uint32_t ce_flags) /* {{{ */
34813481
{
34823482
zend_class_entry *class_entry = malloc(sizeof(zend_class_entry));
34833483
zend_string *lowercase_name;
@@ -3513,14 +3513,14 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class
35133513
* If both parent_ce and parent_name are NULL it does a regular class registration
35143514
* If parent_name is specified but not found NULL is returned
35153515
*/
3516-
ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce) /* {{{ */
3516+
ZEND_API zend_class_entry *zend_register_internal_class_ex(const zend_class_entry *class_entry, zend_class_entry *parent_ce) /* {{{ */
35173517
{
35183518
return zend_register_internal_class_with_flags(class_entry, parent_ce, 0);
35193519
}
35203520
/* }}} */
35213521

35223522
ZEND_API zend_class_entry *zend_register_internal_class_with_flags(
3523-
zend_class_entry *class_entry,
3523+
const zend_class_entry *class_entry,
35243524
zend_class_entry *parent_ce,
35253525
uint32_t ce_flags
35263526
) {
@@ -3558,13 +3558,13 @@ ZEND_API void zend_class_implements(zend_class_entry *class_entry, int num_inter
35583558

35593559
/* A class that contains at least one abstract method automatically becomes an abstract class.
35603560
*/
3561-
ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *orig_class_entry) /* {{{ */
3561+
ZEND_API zend_class_entry *zend_register_internal_class(const zend_class_entry *orig_class_entry) /* {{{ */
35623562
{
35633563
return do_register_internal_class(orig_class_entry, 0);
35643564
}
35653565
/* }}} */
35663566

3567-
ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry) /* {{{ */
3567+
ZEND_API zend_class_entry *zend_register_internal_interface(const zend_class_entry *orig_class_entry) /* {{{ */
35683568
{
35693569
return do_register_internal_class(orig_class_entry, ZEND_ACC_INTERFACE);
35703570
}
@@ -3733,7 +3733,7 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc
37333733
ret = true;
37343734
}
37353735
} else if ((ce = zend_lookup_class(name)) != NULL) {
3736-
zend_class_entry *frame_scope = get_scope(frame);
3736+
const zend_class_entry *frame_scope = get_scope(frame);
37373737
fcc->calling_scope = ce;
37383738
if (frame_scope && !fcc->object) {
37393739
zend_object *object = zend_get_this_object(frame);
@@ -3770,7 +3770,7 @@ ZEND_API void zend_release_fcall_info_cache(zend_fcall_info_cache *fcc) {
37703770
}
37713771
}
37723772

3773-
static zend_always_inline bool zend_is_callable_check_func(zval *callable, const zend_execute_data *frame, zend_fcall_info_cache *fcc, bool strict_class, char **error, bool suppress_deprecation) /* {{{ */
3773+
static zend_always_inline bool zend_is_callable_check_func(const zval *callable, const zend_execute_data *frame, zend_fcall_info_cache *fcc, bool strict_class, char **error, bool suppress_deprecation) /* {{{ */
37743774
{
37753775
zend_class_entry *ce_org = fcc->calling_scope;
37763776
bool retval = false;
@@ -4028,8 +4028,8 @@ ZEND_API zend_string *zend_get_callable_name_ex(zval *callable, const zend_objec
40284028

40294029
case IS_ARRAY:
40304030
{
4031-
zval *method = NULL;
4032-
zval *obj = NULL;
4031+
const zval *method = NULL;
4032+
const zval *obj = NULL;
40334033

40344034
if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2) {
40354035
obj = zend_hash_index_find_deref(Z_ARRVAL_P(callable), 0);
@@ -4081,7 +4081,7 @@ ZEND_API zend_string *zend_get_callable_name(zval *callable) /* {{{ */
40814081
/* }}} */
40824082

40834083
ZEND_API bool zend_is_callable_at_frame(
4084-
zval *callable, zend_object *object, const zend_execute_data *frame,
4084+
const zval *callable, zend_object *object, const zend_execute_data *frame,
40854085
uint32_t check_flags, zend_fcall_info_cache *fcc, char **error) /* {{{ */
40864086
{
40874087
bool ret;
@@ -4402,7 +4402,7 @@ ZEND_API const char *zend_get_module_version(const char *module_name) /* {{{ */
44024402
}
44034403
/* }}} */
44044404

4405-
static zend_always_inline bool is_persistent_class(zend_class_entry *ce) {
4405+
static zend_always_inline bool is_persistent_class(const zend_class_entry *ce) {
44064406
return (ce->type & ZEND_INTERNAL_CLASS)
44074407
&& ce->info.internal.module->type == MODULE_PERSISTENT;
44084408
}
@@ -5154,7 +5154,7 @@ ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling,
51545154
}
51555155
/* }}} */
51565156

5157-
ZEND_API void zend_restore_error_handling(zend_error_handling *saved) /* {{{ */
5157+
ZEND_API void zend_restore_error_handling(const zend_error_handling *saved) /* {{{ */
51585158
{
51595159
EG(error_handling) = saved->handling;
51605160
EG(exception_class) = saved->exception;

0 commit comments

Comments
 (0)