Skip to content

Commit b60a9da

Browse files
committed
Zend/zend_ast: Add const qualifier
1 parent be53902 commit b60a9da

File tree

3 files changed

+51
-51
lines changed

3 files changed

+51
-51
lines changed

Zend/zend_ast.c

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static inline void *zend_ast_alloc(size_t size) {
3333
return zend_arena_alloc(&CG(ast_arena), size);
3434
}
3535

36-
static inline void *zend_ast_realloc(void *old, size_t old_size, size_t new_size) {
36+
static inline void *zend_ast_realloc(const void *old, size_t old_size, size_t new_size) {
3737
void *new = zend_ast_alloc(new_size);
3838
memcpy(new, old, old_size);
3939
return new;
@@ -43,7 +43,7 @@ static inline size_t zend_ast_list_size(uint32_t children) {
4343
return sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * children;
4444
}
4545

46-
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_znode(znode *node) {
46+
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_znode(const znode *node) {
4747
zend_ast_znode *ast;
4848

4949
ast = zend_ast_alloc(sizeof(zend_ast_znode));
@@ -66,7 +66,7 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_fcc(void) {
6666
return (zend_ast *) ast;
6767
}
6868

69-
static zend_always_inline zend_ast * zend_ast_create_zval_int(zval *zv, uint32_t attr, uint32_t lineno) {
69+
static zend_always_inline zend_ast * zend_ast_create_zval_int(const zval *zv, uint32_t attr, uint32_t lineno) {
7070
zend_ast_zval *ast;
7171

7272
ast = zend_ast_alloc(sizeof(zend_ast_zval));
@@ -77,15 +77,15 @@ static zend_always_inline zend_ast * zend_ast_create_zval_int(zval *zv, uint32_t
7777
return (zend_ast *) ast;
7878
}
7979

80-
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_with_lineno(zval *zv, uint32_t lineno) {
80+
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_with_lineno(const zval *zv, uint32_t lineno) {
8181
return zend_ast_create_zval_int(zv, 0, lineno);
8282
}
8383

84-
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr) {
84+
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_ex(const zval *zv, zend_ast_attr attr) {
8585
return zend_ast_create_zval_int(zv, attr, CG(zend_lineno));
8686
}
8787

88-
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval(zval *zv) {
88+
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval(const zval *zv) {
8989
return zend_ast_create_zval_int(zv, 0, CG(zend_lineno));
9090
}
9191

@@ -508,7 +508,7 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_list_add(zend_ast *ast, zend_ast *op)
508508
return (zend_ast *) list;
509509
}
510510

511-
static zend_result zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
511+
static zend_result zend_ast_add_array_element(const zval *result, zval *offset, zval *expr)
512512
{
513513
if (Z_TYPE_P(offset) == IS_UNDEF) {
514514
if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), expr)) {
@@ -528,9 +528,9 @@ static zend_result zend_ast_add_array_element(zval *result, zval *offset, zval *
528528
return SUCCESS;
529529
}
530530

531-
static zend_result zend_ast_add_unpacked_element(zval *result, zval *expr) {
531+
static zend_result zend_ast_add_unpacked_element(const zval *result, const zval *expr) {
532532
if (EXPECTED(Z_TYPE_P(expr) == IS_ARRAY)) {
533-
HashTable *ht = Z_ARRVAL_P(expr);
533+
const HashTable *ht = Z_ARRVAL_P(expr);
534534
zval *val;
535535
zend_string *key;
536536

@@ -1248,7 +1248,7 @@ static size_t ZEND_FASTCALL zend_ast_tree_size(zend_ast *ast)
12481248
size = sizeof(zend_ast_fcc);
12491249
} else if (zend_ast_is_list(ast)) {
12501250
uint32_t i;
1251-
zend_ast_list *list = zend_ast_get_list(ast);
1251+
const zend_ast_list *list = zend_ast_get_list(ast);
12521252

12531253
size = zend_ast_list_size(list->children);
12541254
for (i = 0; i < list->children; i++) {
@@ -1289,7 +1289,7 @@ static void* ZEND_FASTCALL zend_ast_tree_copy(zend_ast *ast, void *buf)
12891289
Z_LINENO(new->val) = zend_ast_get_lineno(ast);
12901290
buf = (void*)((char*)buf + sizeof(zend_ast_zval));
12911291
} else if (zend_ast_is_list(ast)) {
1292-
zend_ast_list *list = zend_ast_get_list(ast);
1292+
const zend_ast_list *list = zend_ast_get_list(ast);
12931293
zend_ast_list *new = (zend_ast_list*)buf;
12941294
uint32_t i;
12951295
new->kind = list->kind;
@@ -1306,7 +1306,7 @@ static void* ZEND_FASTCALL zend_ast_tree_copy(zend_ast *ast, void *buf)
13061306
}
13071307
}
13081308
} else if (ast->kind == ZEND_AST_OP_ARRAY) {
1309-
zend_ast_op_array *old = zend_ast_get_op_array(ast);
1309+
const zend_ast_op_array *old = zend_ast_get_op_array(ast);
13101310
zend_ast_op_array *new = (zend_ast_op_array*)buf;
13111311
new->kind = old->kind;
13121312
new->attr = old->attr;
@@ -1315,7 +1315,7 @@ static void* ZEND_FASTCALL zend_ast_tree_copy(zend_ast *ast, void *buf)
13151315
function_add_ref((zend_function *)new->op_array);
13161316
buf = (void*)((char*)buf + sizeof(zend_ast_op_array));
13171317
} else if (ast->kind == ZEND_AST_CALLABLE_CONVERT) {
1318-
zend_ast_fcc *old = (zend_ast_fcc*)ast;
1318+
const zend_ast_fcc *old = (zend_ast_fcc*)ast;
13191319
zend_ast_fcc *new = (zend_ast_fcc*)buf;
13201320
new->kind = old->kind;
13211321
new->attr = old->attr;
@@ -1376,7 +1376,7 @@ ZEND_API void ZEND_FASTCALL zend_ast_destroy(zend_ast *ast)
13761376
} else if (EXPECTED(ast->kind == ZEND_AST_ZVAL)) {
13771377
zval_ptr_dtor_nogc(zend_ast_get_zval(ast));
13781378
} else if (EXPECTED(zend_ast_is_list(ast))) {
1379-
zend_ast_list *list = zend_ast_get_list(ast);
1379+
const zend_ast_list *list = zend_ast_get_list(ast);
13801380
if (list->children) {
13811381
uint32_t i;
13821382

@@ -1391,7 +1391,7 @@ ZEND_API void ZEND_FASTCALL zend_ast_destroy(zend_ast *ast)
13911391
} else if (EXPECTED(ast->kind == ZEND_AST_OP_ARRAY)) {
13921392
destroy_op_array(zend_ast_get_op_array(ast)->op_array);
13931393
} else if (EXPECTED(zend_ast_is_decl(ast))) {
1394-
zend_ast_decl *decl = (zend_ast_decl *) ast;
1394+
const zend_ast_decl *decl = (zend_ast_decl *) ast;
13951395

13961396
if (decl->name) {
13971397
zend_string_release_ex(decl->name, 0);
@@ -1414,7 +1414,7 @@ ZEND_API void ZEND_FASTCALL zend_ast_ref_destroy(zend_ast_ref *ast)
14141414
efree(ast);
14151415
}
14161416

1417-
ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn, void *context) {
1417+
ZEND_API void zend_ast_apply(zend_ast *ast, const zend_ast_apply_func fn, void *context) {
14181418
if (zend_ast_is_list(ast)) {
14191419
zend_ast_list *list = zend_ast_get_list(ast);
14201420
uint32_t i;
@@ -1470,7 +1470,7 @@ ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn, void *contex
14701470

14711471
static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int priority, int indent);
14721472

1473-
static ZEND_COLD void zend_ast_export_str(smart_str *str, zend_string *s)
1473+
static ZEND_COLD void zend_ast_export_str(smart_str *str, const zend_string *s)
14741474
{
14751475
size_t i;
14761476

@@ -1485,7 +1485,7 @@ static ZEND_COLD void zend_ast_export_str(smart_str *str, zend_string *s)
14851485
}
14861486
}
14871487

1488-
static ZEND_COLD void zend_ast_export_qstr(smart_str *str, char quote, zend_string *s)
1488+
static ZEND_COLD void zend_ast_export_qstr(smart_str *str, char quote, const zend_string *s)
14891489
{
14901490
size_t i;
14911491

@@ -1541,7 +1541,7 @@ static ZEND_COLD void zend_ast_export_indent(smart_str *str, int indent)
15411541
static ZEND_COLD void zend_ast_export_name(smart_str *str, zend_ast *ast, int priority, int indent)
15421542
{
15431543
if (ast->kind == ZEND_AST_ZVAL) {
1544-
zval *zv = zend_ast_get_zval(ast);
1544+
const zval *zv = zend_ast_get_zval(ast);
15451545

15461546
if (Z_TYPE_P(zv) == IS_STRING) {
15471547
smart_str_append(str, Z_STR_P(zv));
@@ -1554,7 +1554,7 @@ static ZEND_COLD void zend_ast_export_name(smart_str *str, zend_ast *ast, int pr
15541554
static ZEND_COLD void zend_ast_export_ns_name(smart_str *str, zend_ast *ast, int priority, int indent)
15551555
{
15561556
if (ast->kind == ZEND_AST_ZVAL) {
1557-
zval *zv = zend_ast_get_zval(ast);
1557+
const zval *zv = zend_ast_get_zval(ast);
15581558

15591559
if (Z_TYPE_P(zv) == IS_STRING) {
15601560
if (ast->attr == ZEND_NAME_FQ) {
@@ -1633,7 +1633,7 @@ static ZEND_COLD void zend_ast_export_var(smart_str *str, zend_ast *ast, int pri
16331633

16341634
/* Use zend_ast_export_list() unless fewer than `list->children` children should
16351635
* be exported. */
1636-
static ZEND_COLD void zend_ast_export_list_ex(smart_str *str, zend_ast_list *list, bool separator, int priority, int indent, int children)
1636+
static ZEND_COLD void zend_ast_export_list_ex(smart_str *str, const zend_ast_list *list, bool separator, int priority, int indent, int children)
16371637
{
16381638
ZEND_ASSERT(children <= list->children);
16391639
uint32_t i = 0;
@@ -1647,20 +1647,20 @@ static ZEND_COLD void zend_ast_export_list_ex(smart_str *str, zend_ast_list *lis
16471647
}
16481648
}
16491649

1650-
static ZEND_COLD void zend_ast_export_list(smart_str *str, zend_ast_list *list, bool separator, int priority, int indent)
1650+
static ZEND_COLD void zend_ast_export_list(smart_str *str, const zend_ast_list *list, bool separator, int priority, int indent)
16511651
{
16521652
zend_ast_export_list_ex(str, list, separator, priority, indent, list->children);
16531653
}
16541654

1655-
static ZEND_COLD void zend_ast_export_encaps_list(smart_str *str, char quote, zend_ast_list *list, int indent)
1655+
static ZEND_COLD void zend_ast_export_encaps_list(smart_str *str, char quote, const zend_ast_list *list, int indent)
16561656
{
16571657
uint32_t i = 0;
16581658
zend_ast *ast;
16591659

16601660
while (i < list->children) {
16611661
ast = list->child[i];
16621662
if (ast->kind == ZEND_AST_ZVAL) {
1663-
zval *zv = zend_ast_get_zval(ast);
1663+
const zval *zv = zend_ast_get_zval(ast);
16641664

16651665
ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
16661666
zend_ast_export_qstr(str, quote, Z_STR_P(zv));
@@ -1681,7 +1681,7 @@ static ZEND_COLD void zend_ast_export_encaps_list(smart_str *str, char quote, ze
16811681
}
16821682
}
16831683

1684-
static ZEND_COLD void zend_ast_export_name_list_ex(smart_str *str, zend_ast_list *list, int indent, const char *separator)
1684+
static ZEND_COLD void zend_ast_export_name_list_ex(smart_str *str, const zend_ast_list *list, int indent, const char *separator)
16851685
{
16861686
uint32_t i = 0;
16871687

@@ -1697,7 +1697,7 @@ static ZEND_COLD void zend_ast_export_name_list_ex(smart_str *str, zend_ast_list
16971697
#define zend_ast_export_name_list(s, l, i) zend_ast_export_name_list_ex(s, l, i, ", ")
16981698
#define zend_ast_export_catch_name_list(s, l, i) zend_ast_export_name_list_ex(s, l, i, "|")
16991699

1700-
static ZEND_COLD void zend_ast_export_var_list(smart_str *str, zend_ast_list *list, int indent)
1700+
static ZEND_COLD void zend_ast_export_var_list(smart_str *str, const zend_ast_list *list, int indent)
17011701
{
17021702
uint32_t i = 0;
17031703

@@ -1722,7 +1722,7 @@ static ZEND_COLD void zend_ast_export_stmt(smart_str *str, zend_ast *ast, int in
17221722

17231723
if (ast->kind == ZEND_AST_STMT_LIST ||
17241724
ast->kind == ZEND_AST_TRAIT_ADAPTATIONS) {
1725-
zend_ast_list *list = (zend_ast_list*)ast;
1725+
const zend_ast_list *list = (const zend_ast_list*)ast;
17261726
uint32_t i = 0;
17271727

17281728
while (i < list->children) {
@@ -1749,8 +1749,8 @@ static ZEND_COLD void zend_ast_export_stmt(smart_str *str, zend_ast *ast, int in
17491749
case ZEND_AST_DECLARE:
17501750
break;
17511751
case ZEND_AST_PROP_GROUP: {
1752-
zend_ast *first_prop = zend_ast_get_list(ast->child[1])->child[0];
1753-
zend_ast *hook_list = first_prop->child[3];
1752+
const zend_ast *first_prop = zend_ast_get_list(ast->child[1])->child[0];
1753+
const zend_ast *hook_list = first_prop->child[3];
17541754
if (hook_list == NULL) {
17551755
smart_str_appendc(str, ';');
17561756
}
@@ -1764,7 +1764,7 @@ static ZEND_COLD void zend_ast_export_stmt(smart_str *str, zend_ast *ast, int in
17641764
}
17651765
}
17661766

1767-
static ZEND_COLD void zend_ast_export_if_stmt(smart_str *str, zend_ast_list *list, int indent)
1767+
static ZEND_COLD void zend_ast_export_if_stmt(smart_str *str, const zend_ast_list *list, int indent)
17681768
{
17691769
uint32_t i;
17701770
zend_ast *ast;
@@ -1788,7 +1788,7 @@ static ZEND_COLD void zend_ast_export_if_stmt(smart_str *str, zend_ast_list *lis
17881788
zend_ast_export_indent(str, indent);
17891789
smart_str_appends(str, "} else ");
17901790
if (ast->child[1] && ast->child[1]->kind == ZEND_AST_IF) {
1791-
list = (zend_ast_list*)ast->child[1];
1791+
list = (const zend_ast_list*)ast->child[1];
17921792
goto tail_call;
17931793
} else {
17941794
smart_str_appends(str, "{\n");
@@ -1801,7 +1801,7 @@ static ZEND_COLD void zend_ast_export_if_stmt(smart_str *str, zend_ast_list *lis
18011801
smart_str_appendc(str, '}');
18021802
}
18031803

1804-
static ZEND_COLD void zend_ast_export_zval(smart_str *str, zval *zv, int priority, int indent)
1804+
static ZEND_COLD void zend_ast_export_zval(smart_str *str, const zval *zv, int priority, int indent)
18051805
{
18061806
ZVAL_DEREF(zv);
18071807
switch (Z_TYPE_P(zv)) {
@@ -1858,7 +1858,7 @@ static ZEND_COLD void zend_ast_export_zval(smart_str *str, zval *zv, int priorit
18581858
}
18591859
}
18601860

1861-
static ZEND_COLD void zend_ast_export_class_no_header(smart_str *str, zend_ast_decl *decl, int indent) {
1861+
static ZEND_COLD void zend_ast_export_class_no_header(smart_str *str, const zend_ast_decl *decl, int indent) {
18621862
if (decl->child[0]) {
18631863
smart_str_appends(str, " extends ");
18641864
zend_ast_export_ns_name(str, decl->child[0], 0, indent);
@@ -1874,9 +1874,9 @@ static ZEND_COLD void zend_ast_export_class_no_header(smart_str *str, zend_ast_d
18741874
}
18751875

18761876
static ZEND_COLD void zend_ast_export_attribute_group(smart_str *str, zend_ast *ast, int indent) {
1877-
zend_ast_list *list = zend_ast_get_list(ast);
1877+
const zend_ast_list *list = zend_ast_get_list(ast);
18781878
for (uint32_t i = 0; i < list->children; i++) {
1879-
zend_ast *attr = list->child[i];
1879+
const zend_ast *attr = list->child[i];
18801880

18811881
if (i) {
18821882
smart_str_appends(str, ", ");
@@ -1892,7 +1892,7 @@ static ZEND_COLD void zend_ast_export_attribute_group(smart_str *str, zend_ast *
18921892
}
18931893

18941894
static ZEND_COLD void zend_ast_export_attributes(smart_str *str, zend_ast *ast, int indent, bool newlines) {
1895-
zend_ast_list *list = zend_ast_get_list(ast);
1895+
const zend_ast_list *list = zend_ast_get_list(ast);
18961896
uint32_t i;
18971897

18981898
for (i = 0; i < list->children; i++) {
@@ -1931,7 +1931,7 @@ static ZEND_COLD void zend_ast_export_visibility(smart_str *str, uint32_t flags,
19311931

19321932
static ZEND_COLD void zend_ast_export_type(smart_str *str, zend_ast *ast, int indent) {
19331933
if (ast->kind == ZEND_AST_TYPE_UNION) {
1934-
zend_ast_list *list = zend_ast_get_list(ast);
1934+
const zend_ast_list *list = zend_ast_get_list(ast);
19351935
for (uint32_t i = 0; i < list->children; i++) {
19361936
if (i != 0) {
19371937
smart_str_appendc(str, '|');
@@ -1941,7 +1941,7 @@ static ZEND_COLD void zend_ast_export_type(smart_str *str, zend_ast *ast, int in
19411941
return;
19421942
}
19431943
if (ast->kind == ZEND_AST_TYPE_INTERSECTION) {
1944-
zend_ast_list *list = zend_ast_get_list(ast);
1944+
const zend_ast_list *list = zend_ast_get_list(ast);
19451945
for (uint32_t i = 0; i < list->children; i++) {
19461946
if (i != 0) {
19471947
smart_str_appendc(str, '&');
@@ -1956,15 +1956,15 @@ static ZEND_COLD void zend_ast_export_type(smart_str *str, zend_ast *ast, int in
19561956
zend_ast_export_ns_name(str, ast, 0, indent);
19571957
}
19581958

1959-
static ZEND_COLD void zend_ast_export_hook_list(smart_str *str, zend_ast_list *hook_list, int indent)
1959+
static ZEND_COLD void zend_ast_export_hook_list(smart_str *str, const zend_ast_list *hook_list, int indent)
19601960
{
19611961
smart_str_appends(str, " {");
19621962
smart_str_appendc(str, '\n');
19631963
indent++;
19641964
zend_ast_export_indent(str, indent);
19651965

19661966
for (uint32_t i = 0; i < hook_list->children; i++) {
1967-
zend_ast_decl *hook = (zend_ast_decl *)hook_list->child[i];
1967+
const zend_ast_decl *hook = (const zend_ast_decl *)hook_list->child[i];
19681968
zend_ast_export_visibility(str, hook->flags, ZEND_MODIFIER_TARGET_PROPERTY);
19691969
if (hook->flags & ZEND_ACC_FINAL) {
19701970
smart_str_appends(str, "final ");

Zend/zend_ast.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ typedef struct _zend_ast_fcc {
239239
typedef void (*zend_ast_process_t)(zend_ast *ast);
240240
extern ZEND_API zend_ast_process_t zend_ast_process;
241241

242-
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_with_lineno(zval *zv, uint32_t lineno);
243-
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr);
244-
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval(zval *zv);
242+
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_with_lineno(const zval *zv, uint32_t lineno);
243+
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_ex(const zval *zv, zend_ast_attr attr);
244+
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval(const zval *zv);
245245
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_from_str(zend_string *str);
246246
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_from_long(zend_long lval);
247247

@@ -348,15 +348,15 @@ static zend_always_inline size_t zend_ast_size(uint32_t children) {
348348
return XtOffsetOf(zend_ast, child) + (sizeof(zend_ast *) * children);
349349
}
350350

351-
static zend_always_inline bool zend_ast_is_special(zend_ast *ast) {
351+
static zend_always_inline bool zend_ast_is_special(const zend_ast *ast) {
352352
return (ast->kind >> ZEND_AST_SPECIAL_SHIFT) & 1;
353353
}
354354

355-
static zend_always_inline bool zend_ast_is_decl(zend_ast *ast) {
355+
static zend_always_inline bool zend_ast_is_decl(const zend_ast *ast) {
356356
return zend_ast_is_special(ast) && ast->kind >= ZEND_AST_FUNC_DECL;
357357
}
358358

359-
static zend_always_inline bool zend_ast_is_list(zend_ast *ast) {
359+
static zend_always_inline bool zend_ast_is_list(const zend_ast *ast) {
360360
return (ast->kind >> ZEND_AST_IS_LIST_SHIFT) & 1;
361361
}
362362
static zend_always_inline zend_ast_list *zend_ast_get_list(zend_ast *ast) {
@@ -369,7 +369,7 @@ static zend_always_inline zval *zend_ast_get_zval(zend_ast *ast) {
369369
return &((zend_ast_zval *) ast)->val;
370370
}
371371
static zend_always_inline zend_string *zend_ast_get_str(zend_ast *ast) {
372-
zval *zv = zend_ast_get_zval(ast);
372+
const zval *zv = zend_ast_get_zval(ast);
373373
ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
374374
return Z_STR_P(zv);
375375
}
@@ -385,18 +385,18 @@ static zend_always_inline zend_string *zend_ast_get_constant_name(zend_ast *ast)
385385
return Z_STR(((zend_ast_zval *) ast)->val);
386386
}
387387

388-
static zend_always_inline uint32_t zend_ast_get_num_children(zend_ast *ast) {
388+
static zend_always_inline uint32_t zend_ast_get_num_children(const zend_ast *ast) {
389389
ZEND_ASSERT(!zend_ast_is_list(ast));
390390
ZEND_ASSERT(!zend_ast_is_special(ast));
391391

392392
return ast->kind >> ZEND_AST_NUM_CHILDREN_SHIFT;
393393
}
394394
static zend_always_inline uint32_t zend_ast_get_lineno(zend_ast *ast) {
395395
if (ast->kind == ZEND_AST_ZVAL) {
396-
zval *zv = zend_ast_get_zval(ast);
396+
const zval *zv = zend_ast_get_zval(ast);
397397
return Z_LINENO_P(zv);
398398
} else if (ast->kind == ZEND_AST_CONSTANT) {
399-
zval *zv = &((zend_ast_zval *) ast)->val;
399+
const zval *zv = &((const zend_ast_zval *) ast)->val;
400400
return Z_LINENO_P(zv);
401401
} else {
402402
return ast->lineno;

0 commit comments

Comments
 (0)