Skip to content

Commit f514953

Browse files
MaxKellermannGirgias
authored andcommittedJan 4, 2023
Zend/zend_API: make several pointers const
1 parent a8eb399 commit f514953

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed
 

‎Zend/zend_API.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ static ZEND_COLD bool zend_null_arg_deprecated(const char *fallback_type, uint32
477477
return !EG(exception);
478478
}
479479

480-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, bool *dest, uint32_t arg_num) /* {{{ */
480+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(const zval *arg, bool *dest, uint32_t arg_num) /* {{{ */
481481
{
482482
if (EXPECTED(Z_TYPE_P(arg) <= IS_STRING)) {
483483
if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("bool", arg_num)) {
@@ -491,7 +491,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, bool *dest, uint
491491
}
492492
/* }}} */
493493

494-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, bool *dest, uint32_t arg_num) /* {{{ */
494+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(const zval *arg, bool *dest, uint32_t arg_num) /* {{{ */
495495
{
496496
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
497497
return 0;
@@ -500,7 +500,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, bool *dest, uint
500500
}
501501
/* }}} */
502502

503-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest, uint32_t arg_num) /* {{{ */
503+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long *dest, uint32_t arg_num) /* {{{ */
504504
{
505505
if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
506506
if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) {
@@ -570,7 +570,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest,
570570
}
571571
/* }}} */
572572

573-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest, uint32_t arg_num) /* {{{ */
573+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(const zval *arg, zend_long *dest, uint32_t arg_num) /* {{{ */
574574
{
575575
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
576576
return 0;
@@ -579,7 +579,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest,
579579
}
580580
/* }}} */
581581

582-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest, uint32_t arg_num) /* {{{ */
582+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(const zval *arg, double *dest, uint32_t arg_num) /* {{{ */
583583
{
584584
if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
585585
*dest = (double)Z_LVAL_P(arg);
@@ -611,7 +611,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest,
611611
}
612612
/* }}} */
613613

614-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest, uint32_t arg_num) /* {{{ */
614+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(const zval *arg, double *dest, uint32_t arg_num) /* {{{ */
615615
{
616616
if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
617617
/* SSTH Exception: IS_LONG may be accepted instead as IS_DOUBLE */
@@ -4904,7 +4904,7 @@ ZEND_API ZEND_COLD const char *zend_get_object_type_case(const zend_class_entry
49044904
}
49054905
/* }}} */
49064906

4907-
ZEND_API bool zend_is_iterable(zval *iterable) /* {{{ */
4907+
ZEND_API bool zend_is_iterable(const zval *iterable) /* {{{ */
49084908
{
49094909
switch (Z_TYPE_P(iterable)) {
49104910
case IS_ARRAY:
@@ -4917,7 +4917,7 @@ ZEND_API bool zend_is_iterable(zval *iterable) /* {{{ */
49174917
}
49184918
/* }}} */
49194919

4920-
ZEND_API bool zend_is_countable(zval *countable) /* {{{ */
4920+
ZEND_API bool zend_is_countable(const zval *countable) /* {{{ */
49214921
{
49224922
switch (Z_TYPE_P(countable)) {
49234923
case IS_ARRAY:

‎Zend/zend_API.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -904,9 +904,9 @@ static zend_always_inline const char *zend_get_object_type_uc(const zend_class_e
904904
return zend_get_object_type_case(ce, true);
905905
}
906906

907-
ZEND_API bool zend_is_iterable(zval *iterable);
907+
ZEND_API bool zend_is_iterable(const zval *iterable);
908908

909-
ZEND_API bool zend_is_countable(zval *countable);
909+
ZEND_API bool zend_is_countable(const zval *countable);
910910

911911
ZEND_API zend_result zend_get_default_from_internal_arg_info(
912912
zval *default_value_zval, zend_internal_arg_info *arg_info);
@@ -2127,18 +2127,18 @@ ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *
21272127
/* Inlined implementations shared by new and old parameter parsing APIs */
21282128

21292129
ZEND_API bool ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, bool check_null);
2130-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, bool *dest, uint32_t arg_num);
2131-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, bool *dest, uint32_t arg_num);
2132-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest, uint32_t arg_num);
2133-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest, uint32_t arg_num);
2134-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest, uint32_t arg_num);
2135-
ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest, uint32_t arg_num);
2130+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(const zval *arg, bool *dest, uint32_t arg_num);
2131+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(const zval *arg, bool *dest, uint32_t arg_num);
2132+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(const zval *arg, zend_long *dest, uint32_t arg_num);
2133+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long *dest, uint32_t arg_num);
2134+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(const zval *arg, double *dest, uint32_t arg_num);
2135+
ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(const zval *arg, double *dest, uint32_t arg_num);
21362136
ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest, uint32_t arg_num);
21372137
ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest, uint32_t arg_num);
21382138
ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest, uint32_t arg_num);
21392139
ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long, uint32_t arg_num);
21402140

2141-
static zend_always_inline bool zend_parse_arg_bool(zval *arg, bool *dest, bool *is_null, bool check_null, uint32_t arg_num)
2141+
static zend_always_inline bool zend_parse_arg_bool(const zval *arg, bool *dest, bool *is_null, bool check_null, uint32_t arg_num)
21422142
{
21432143
if (check_null) {
21442144
*is_null = 0;
@@ -2172,7 +2172,7 @@ static zend_always_inline bool zend_parse_arg_long(zval *arg, zend_long *dest, b
21722172
return 1;
21732173
}
21742174

2175-
static zend_always_inline bool zend_parse_arg_double(zval *arg, double *dest, bool *is_null, bool check_null, uint32_t arg_num)
2175+
static zend_always_inline bool zend_parse_arg_double(const zval *arg, double *dest, bool *is_null, bool check_null, uint32_t arg_num)
21762176
{
21772177
if (check_null) {
21782178
*is_null = 0;
@@ -2283,7 +2283,7 @@ static zend_always_inline bool zend_parse_arg_array(zval *arg, zval **dest, bool
22832283
return 1;
22842284
}
22852285

2286-
static zend_always_inline bool zend_parse_arg_array_ht(zval *arg, HashTable **dest, bool check_null, bool or_object, bool separate)
2286+
static zend_always_inline bool zend_parse_arg_array_ht(const zval *arg, HashTable **dest, bool check_null, bool or_object, bool separate)
22872287
{
22882288
if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY)) {
22892289
*dest = Z_ARRVAL_P(arg);
@@ -2342,7 +2342,7 @@ static zend_always_inline bool zend_parse_arg_object(zval *arg, zval **dest, zen
23422342
return 1;
23432343
}
23442344

2345-
static zend_always_inline bool zend_parse_arg_obj(zval *arg, zend_object **dest, zend_class_entry *ce, bool check_null)
2345+
static zend_always_inline bool zend_parse_arg_obj(const zval *arg, zend_object **dest, zend_class_entry *ce, bool check_null)
23462346
{
23472347
if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT) &&
23482348
(!ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), ce) != 0))) {

0 commit comments

Comments
 (0)