Skip to content

Commit 584ae5e

Browse files
committed
Zend/zend_execute_API.c: add const qualifiers
1 parent 5668b16 commit 584ae5e

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

Zend/zend_execute.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ ZEND_API void zend_init_code_execute_data(zend_execute_data *execute_data, zend_
4848
ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value);
4949
ZEND_API void execute_ex(zend_execute_data *execute_data);
5050
ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value);
51-
ZEND_API bool zend_is_valid_class_name(zend_string *name);
51+
ZEND_API bool zend_is_valid_class_name(const zend_string *name);
5252
ZEND_API zend_class_entry *zend_lookup_class(zend_string *name);
5353
ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags);
54-
ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex);
55-
ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex);
54+
ZEND_API zend_class_entry *zend_get_called_scope(const zend_execute_data *ex);
55+
ZEND_API zend_object *zend_get_this_object(const zend_execute_data *ex);
5656
ZEND_API zend_result zend_eval_string(const char *str, zval *retval_ptr, const char *string_name);
5757
ZEND_API zend_result zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name);
5858
ZEND_API zend_result zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, bool handle_exceptions);
@@ -453,7 +453,7 @@ ZEND_API const char *get_active_class_name(const char **space);
453453
ZEND_API const char *get_active_function_name(void);
454454
ZEND_API const char *get_active_function_arg_name(uint32_t arg_num);
455455
ZEND_API const char *get_function_arg_name(const zend_function *func, uint32_t arg_num);
456-
ZEND_API zend_function *zend_active_function_ex(zend_execute_data *execute_data);
456+
ZEND_API zend_function *zend_active_function_ex(const zend_execute_data *execute_data);
457457

458458
static zend_always_inline zend_function *zend_active_function(void)
459459
{

Zend/zend_execute_API.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ static void zend_handle_sigsegv(void) /* {{{ */
8888
/* }}} */
8989
#endif
9090

91-
static void zend_extension_activator(zend_extension *extension) /* {{{ */
91+
static void zend_extension_activator(const zend_extension *extension) /* {{{ */
9292
{
9393
if (extension->activate) {
9494
extension->activate();
9595
}
9696
}
9797
/* }}} */
9898

99-
static void zend_extension_deactivator(zend_extension *extension) /* {{{ */
99+
static void zend_extension_deactivator(const zend_extension *extension) /* {{{ */
100100
{
101101
if (extension->deactivate) {
102102
extension->deactivate();
@@ -113,14 +113,14 @@ static int clean_non_persistent_constant_full(zval *zv) /* {{{ */
113113

114114
static int clean_non_persistent_function_full(zval *zv) /* {{{ */
115115
{
116-
zend_function *function = Z_PTR_P(zv);
116+
const zend_function *function = Z_PTR_P(zv);
117117
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
118118
}
119119
/* }}} */
120120

121121
static int clean_non_persistent_class_full(zval *zv) /* {{{ */
122122
{
123-
zend_class_entry *ce = Z_PTR_P(zv);
123+
const zend_class_entry *ce = Z_PTR_P(zv);
124124
return (ce->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
125125
}
126126
/* }}} */
@@ -536,7 +536,7 @@ void shutdown_executor(void) /* {{{ */
536536
/* return class name and "::" or "". */
537537
ZEND_API const char *get_active_class_name(const char **space) /* {{{ */
538538
{
539-
zend_function *func;
539+
const zend_function *func;
540540

541541
if (!zend_is_executing()) {
542542
if (space) {
@@ -551,7 +551,7 @@ ZEND_API const char *get_active_class_name(const char **space) /* {{{ */
551551
case ZEND_USER_FUNCTION:
552552
case ZEND_INTERNAL_FUNCTION:
553553
{
554-
zend_class_entry *ce = func->common.scope;
554+
const zend_class_entry *ce = func->common.scope;
555555

556556
if (space) {
557557
*space = ce ? "::" : "";
@@ -569,7 +569,7 @@ ZEND_API const char *get_active_class_name(const char **space) /* {{{ */
569569

570570
ZEND_API const char *get_active_function_name(void) /* {{{ */
571571
{
572-
zend_function *func;
572+
const zend_function *func;
573573

574574
if (!zend_is_executing()) {
575575
return NULL;
@@ -579,7 +579,7 @@ ZEND_API const char *get_active_function_name(void) /* {{{ */
579579

580580
switch (func->type) {
581581
case ZEND_USER_FUNCTION: {
582-
zend_string *function_name = func->common.function_name;
582+
const zend_string *function_name = func->common.function_name;
583583

584584
if (function_name) {
585585
return ZSTR_VAL(function_name);
@@ -597,7 +597,7 @@ ZEND_API const char *get_active_function_name(void) /* {{{ */
597597
}
598598
/* }}} */
599599

600-
ZEND_API zend_function *zend_active_function_ex(zend_execute_data *execute_data)
600+
ZEND_API zend_function *zend_active_function_ex(const zend_execute_data *execute_data)
601601
{
602602
zend_function *func = EX(func);
603603

@@ -636,7 +636,7 @@ ZEND_API const char *get_active_function_arg_name(uint32_t arg_num) /* {{{ */
636636
return NULL;
637637
}
638638

639-
zend_function *func = zend_active_function();
639+
const zend_function *func = zend_active_function();
640640

641641
return get_function_arg_name(func, arg_num);
642642
}
@@ -658,7 +658,7 @@ ZEND_API const char *get_function_arg_name(const zend_function *func, uint32_t a
658658

659659
ZEND_API const char *zend_get_executed_filename(void) /* {{{ */
660660
{
661-
zend_string *filename = zend_get_executed_filename_ex();
661+
const zend_string *filename = zend_get_executed_filename_ex();
662662
return filename != NULL ? ZSTR_VAL(filename) : "[no active file]";
663663
}
664664
/* }}} */
@@ -670,7 +670,7 @@ ZEND_API zend_string *zend_get_executed_filename_ex(void) /* {{{ */
670670
return filename_override;
671671
}
672672

673-
zend_execute_data *ex = EG(current_execute_data);
673+
const zend_execute_data *ex = EG(current_execute_data);
674674

675675
while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
676676
ex = ex->prev_execute_data;
@@ -690,7 +690,7 @@ ZEND_API uint32_t zend_get_executed_lineno(void) /* {{{ */
690690
return lineno_override;
691691
}
692692

693-
zend_execute_data *ex = EG(current_execute_data);
693+
const zend_execute_data *ex = EG(current_execute_data);
694694

695695
while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
696696
ex = ex->prev_execute_data;
@@ -739,7 +739,7 @@ ZEND_API zend_result ZEND_FASTCALL zval_update_constant_with_ctx(zval *p, zend_c
739739

740740
if (ast->kind == ZEND_AST_CONSTANT) {
741741
zend_string *name = zend_ast_get_constant_name(ast);
742-
zval *zv = zend_get_constant_ex(name, scope, ast->attr);
742+
const zval *zv = zend_get_constant_ex(name, scope, ast->attr);
743743
if (UNEXPECTED(zv == NULL)) {
744744
return FAILURE;
745745
}
@@ -1158,7 +1158,7 @@ static const uint32_t valid_chars[8] = {
11581158
0xffffffff,
11591159
};
11601160

1161-
ZEND_API bool zend_is_valid_class_name(zend_string *name) {
1161+
ZEND_API bool zend_is_valid_class_name(const zend_string *name) {
11621162
for (size_t i = 0; i < ZSTR_LEN(name); i++) {
11631163
unsigned char c = ZSTR_VAL(name)[i];
11641164
if (!ZEND_BIT_TEST(valid_chars, c)) {
@@ -1298,7 +1298,7 @@ ZEND_API zend_class_entry *zend_lookup_class(zend_string *name) /* {{{ */
12981298
}
12991299
/* }}} */
13001300

1301-
ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex) /* {{{ */
1301+
ZEND_API zend_class_entry *zend_get_called_scope(const zend_execute_data *ex) /* {{{ */
13021302
{
13031303
while (ex) {
13041304
if (Z_TYPE(ex->This) == IS_OBJECT) {
@@ -1316,7 +1316,7 @@ ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex) /* {{{ *
13161316
}
13171317
/* }}} */
13181318

1319-
ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex) /* {{{ */
1319+
ZEND_API zend_object *zend_get_this_object(const zend_execute_data *ex) /* {{{ */
13201320
{
13211321
while (ex) {
13221322
if (Z_TYPE(ex->This) == IS_OBJECT) {
@@ -1689,7 +1689,7 @@ void zend_unset_timeout(void) /* {{{ */
16891689
}
16901690
/* }}} */
16911691

1692-
static ZEND_COLD void report_class_fetch_error(zend_string *class_name, uint32_t fetch_type)
1692+
static ZEND_COLD void report_class_fetch_error(const zend_string *class_name, uint32_t fetch_type)
16931693
{
16941694
if (fetch_type & ZEND_FETCH_CLASS_SILENT) {
16951695
return;
@@ -1858,7 +1858,7 @@ ZEND_API zend_array *zend_rebuild_symbol_table(void) /* {{{ */
18581858

18591859
ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data) /* {{{ */
18601860
{
1861-
zend_op_array *op_array = &execute_data->func->op_array;
1861+
const zend_op_array *op_array = &execute_data->func->op_array;
18621862
HashTable *ht = execute_data->symbol_table;
18631863

18641864
/* copy real values from symbol table into CV slots and create
@@ -1873,7 +1873,7 @@ ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data) /* {{{ *
18731873

18741874
if (zv) {
18751875
if (Z_TYPE_P(zv) == IS_INDIRECT) {
1876-
zval *val = Z_INDIRECT_P(zv);
1876+
const zval *val = Z_INDIRECT_P(zv);
18771877

18781878
ZVAL_COPY_VALUE(var, val);
18791879
} else {
@@ -1893,7 +1893,7 @@ ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data) /* {{{ *
18931893

18941894
ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data) /* {{{ */
18951895
{
1896-
zend_op_array *op_array = &execute_data->func->op_array;
1896+
const zend_op_array *op_array = &execute_data->func->op_array;
18971897
HashTable *ht = execute_data->symbol_table;
18981898

18991899
/* copy real values from CV slots into symbol table */
@@ -1927,7 +1927,7 @@ ZEND_API zend_result zend_set_local_var(zend_string *name, zval *value, bool for
19271927
if (execute_data) {
19281928
if (!(EX_CALL_INFO() & ZEND_CALL_HAS_SYMBOL_TABLE)) {
19291929
zend_ulong h = zend_string_hash_val(name);
1930-
zend_op_array *op_array = &execute_data->func->op_array;
1930+
const zend_op_array *op_array = &execute_data->func->op_array;
19311931

19321932
if (EXPECTED(op_array->last_var)) {
19331933
zend_string **str = op_array->vars;
@@ -1970,7 +1970,7 @@ ZEND_API zend_result zend_set_local_var_str(const char *name, size_t len, zval *
19701970
if (execute_data) {
19711971
if (!(EX_CALL_INFO() & ZEND_CALL_HAS_SYMBOL_TABLE)) {
19721972
zend_ulong h = zend_hash_func(name, len);
1973-
zend_op_array *op_array = &execute_data->func->op_array;
1973+
const zend_op_array *op_array = &execute_data->func->op_array;
19741974
if (EXPECTED(op_array->last_var)) {
19751975
zend_string **str = op_array->vars;
19761976
zend_string **end = str + op_array->last_var;

0 commit comments

Comments
 (0)