@@ -1053,7 +1053,7 @@ accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_
10531053 !EG (current_execute_data ) &&
10541054 file_handle -> primary_script ) {
10551055
1056- zend_stat_t * tmpbuf = sapi_module .get_stat ();
1056+ const zend_stat_t * tmpbuf = sapi_module .get_stat ();
10571057
10581058 if (tmpbuf ) {
10591059 if (size ) {
@@ -1134,7 +1134,7 @@ accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_
11341134 return statbuf .st_mtime ;
11351135}
11361136
1137- static inline zend_result do_validate_timestamps (zend_persistent_script * persistent_script , zend_file_handle * file_handle )
1137+ static inline zend_result do_validate_timestamps (const zend_persistent_script * persistent_script , zend_file_handle * file_handle )
11381138{
11391139 zend_file_handle ps_handle ;
11401140 zend_string * full_path_ptr = NULL ;
@@ -1239,7 +1239,7 @@ zend_string *accel_make_persistent_key(zend_string *str)
12391239 } else {
12401240 const char * include_path = NULL , * cwd = NULL ;
12411241 int include_path_len = 0 , cwd_len = 0 ;
1242- zend_string * parent_script = NULL ;
1242+ const zend_string * parent_script = NULL ;
12431243
12441244 if (EXPECTED (ZCG (cwd_key_len ))) {
12451245 cwd = ZCG (cwd_key );
@@ -1274,7 +1274,7 @@ zend_string *accel_make_persistent_key(zend_string *str)
12741274 }
12751275 if (str ) {
12761276 char buf [32 ];
1277- char * res = zend_print_long_to_buf (buf + sizeof (buf ) - 1 , STRTAB_STR_TO_POS (& ZCSG (interned_strings ), str ));
1277+ const char * res = zend_print_long_to_buf (buf + sizeof (buf ) - 1 , STRTAB_STR_TO_POS (& ZCSG (interned_strings ), str ));
12781278
12791279 cwd_len = ZCG (cwd_key_len ) = buf + sizeof (buf ) - 1 - res ;
12801280 cwd = ZCG (cwd_key );
@@ -1318,7 +1318,7 @@ zend_string *accel_make_persistent_key(zend_string *str)
13181318 }
13191319 if (str ) {
13201320 char buf [32 ];
1321- char * res = zend_print_long_to_buf (buf + sizeof (buf ) - 1 , STRTAB_STR_TO_POS (& ZCSG (interned_strings ), str ));
1321+ const char * res = zend_print_long_to_buf (buf + sizeof (buf ) - 1 , STRTAB_STR_TO_POS (& ZCSG (interned_strings ), str ));
13221322
13231323 include_path_len = ZCG (include_path_key_len ) = buf + sizeof (buf ) - 1 - res ;
13241324 include_path = ZCG (include_path_key );
@@ -1517,7 +1517,7 @@ static void zend_accel_add_key(zend_string *key, zend_accel_hash_entry *bucket)
15171517 }
15181518}
15191519
1520- static zend_always_inline bool is_phar_file (zend_string * filename )
1520+ static zend_always_inline bool is_phar_file (const zend_string * filename )
15211521{
15221522 return filename && ZSTR_LEN (filename ) >= sizeof (".phar" ) &&
15231523 !memcmp (ZSTR_VAL (filename ) + ZSTR_LEN (filename ) - (sizeof (".phar" )- 1 ), ".phar" , sizeof (".phar" )- 1 ) &&
@@ -1987,7 +1987,7 @@ static zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int
19871987 return op_array ;
19881988}
19891989
1990- static bool check_persistent_script_access (zend_persistent_script * persistent_script )
1990+ static bool check_persistent_script_access (const zend_persistent_script * persistent_script )
19911991{
19921992 char * phar_path , * ptr ;
19931993 if ((ZSTR_LEN (persistent_script -> script .filename )< sizeof ("phar://.phar" )) ||
@@ -2288,7 +2288,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
22882288 return zend_accel_load_script (persistent_script , from_shared_memory );
22892289}
22902290
2291- static zend_always_inline zend_inheritance_cache_entry * zend_accel_inheritance_cache_find (zend_inheritance_cache_entry * entry , zend_class_entry * ce , zend_class_entry * parent , zend_class_entry * * traits_and_interfaces , bool * needs_autoload_ptr )
2291+ static zend_always_inline zend_inheritance_cache_entry * zend_accel_inheritance_cache_find (zend_inheritance_cache_entry * entry , const zend_class_entry * ce , const zend_class_entry * parent , zend_class_entry * * traits_and_interfaces , bool * needs_autoload_ptr )
22922292{
22932293 uint32_t i ;
22942294
@@ -2310,10 +2310,10 @@ static zend_always_inline zend_inheritance_cache_entry* zend_accel_inheritance_c
23102310 }
23112311 if (found && entry -> dependencies ) {
23122312 for (i = 0 ; i < entry -> dependencies_count ; i ++ ) {
2313- zend_class_entry * ce = zend_lookup_class_ex (entry -> dependencies [i ].name , NULL , ZEND_FETCH_CLASS_NO_AUTOLOAD );
2313+ const zend_class_entry * dependency_ce = zend_lookup_class_ex (entry -> dependencies [i ].name , NULL , ZEND_FETCH_CLASS_NO_AUTOLOAD );
23142314
2315- if (ce != entry -> dependencies [i ].ce ) {
2316- if (!ce ) {
2315+ if (dependency_ce != entry -> dependencies [i ].ce ) {
2316+ if (!dependency_ce ) {
23172317 needs_autoload = true;
23182318 } else {
23192319 found = false;
@@ -2354,9 +2354,9 @@ static zend_class_entry* zend_accel_inheritance_cache_get(zend_class_entry *ce,
23542354 }
23552355
23562356 for (uint32_t i = 0 ; i < entry -> dependencies_count ; i ++ ) {
2357- zend_class_entry * ce = zend_lookup_class_ex (entry -> dependencies [i ].name , NULL , 0 );
2357+ const zend_class_entry * dependency_ce = zend_lookup_class_ex (entry -> dependencies [i ].name , NULL , 0 );
23582358
2359- if (ce == NULL ) {
2359+ if (dependency_ce == NULL ) {
23602360 return NULL ;
23612361 }
23622362 }
@@ -2585,7 +2585,7 @@ static zend_string* persistent_zend_resolve_path(zend_string *filename)
25852585 /* lookup by "not-real" path */
25862586 key = accel_make_persistent_key (filename );
25872587 if (key ) {
2588- zend_accel_hash_entry * bucket = zend_accel_hash_find_entry (& ZCSG (hash ), key );
2588+ const zend_accel_hash_entry * bucket = zend_accel_hash_find_entry (& ZCSG (hash ), key );
25892589 if (bucket != NULL ) {
25902590 zend_persistent_script * persistent_script = (zend_persistent_script * )bucket -> data ;
25912591 if (!persistent_script -> corrupted ) {
@@ -3640,7 +3640,7 @@ static void preload_shutdown(void)
36403640
36413641 if (EG (function_table )) {
36423642 ZEND_HASH_MAP_REVERSE_FOREACH_VAL (EG (function_table ), zv ) {
3643- zend_function * func = Z_PTR_P (zv );
3643+ const zend_function * func = Z_PTR_P (zv );
36443644 if (func -> type == ZEND_INTERNAL_FUNCTION ) {
36453645 break ;
36463646 }
@@ -3649,7 +3649,7 @@ static void preload_shutdown(void)
36493649
36503650 if (EG (class_table )) {
36513651 ZEND_HASH_MAP_REVERSE_FOREACH_VAL (EG (class_table ), zv ) {
3652- zend_class_entry * ce = Z_PTR_P (zv );
3652+ const zend_class_entry * ce = Z_PTR_P (zv );
36533653 if (ce -> type == ZEND_INTERNAL_CLASS && Z_TYPE_P (zv ) != IS_ALIAS_PTR ) {
36543654 break ;
36553655 }
@@ -3676,7 +3676,7 @@ static void preload_restart(void)
36763676 }
36773677}
36783678
3679- static size_t preload_try_strip_filename (zend_string * filename ) {
3679+ static size_t preload_try_strip_filename (const zend_string * filename ) {
36803680 /*FIXME: better way to handle eval()'d code? see COMPILED_STRING_DESCRIPTION_FORMAT */
36813681 if (ZSTR_LEN (filename ) > sizeof (" eval()'d code" )
36823682 && * (ZSTR_VAL (filename ) + ZSTR_LEN (filename ) - sizeof (" eval()'d code" )) == ':' ) {
@@ -3797,17 +3797,17 @@ static void preload_sort_classes(void *base, size_t count, size_t siz, compare_f
37973797 Bucket * b2 ;
37983798 Bucket * end = b1 + count ;
37993799 Bucket tmp ;
3800- zend_class_entry * ce , * p ;
3800+ const zend_class_entry * ce , * p ;
38013801
38023802 while (b1 < end ) {
38033803try_again :
3804- ce = ( zend_class_entry * ) Z_PTR (b1 -> val );
3804+ ce = Z_PTR (b1 -> val );
38053805 if (ce -> parent && (ce -> ce_flags & ZEND_ACC_LINKED )) {
38063806 p = ce -> parent ;
38073807 if (p -> type == ZEND_USER_CLASS ) {
38083808 b2 = b1 + 1 ;
38093809 while (b2 < end ) {
3810- if (p == Z_PTR (b2 -> val )) {
3810+ if (p == Z_PTR (b2 -> val )) {
38113811 tmp = * b1 ;
38123812 * b1 = * b2 ;
38133813 * b2 = tmp ;
@@ -3824,7 +3824,7 @@ static void preload_sort_classes(void *base, size_t count, size_t siz, compare_f
38243824 if (p -> type == ZEND_USER_CLASS ) {
38253825 b2 = b1 + 1 ;
38263826 while (b2 < end ) {
3827- if (p == Z_PTR (b2 -> val )) {
3827+ if (p == Z_PTR (b2 -> val )) {
38283828 tmp = * b1 ;
38293829 * b1 = * b2 ;
38303830 * b2 = tmp ;
@@ -3850,7 +3850,7 @@ static zend_result preload_resolve_deps(preload_error *error, const zend_class_e
38503850
38513851 if (ce -> parent_name ) {
38523852 zend_string * key = zend_string_tolower (ce -> parent_name );
3853- zend_class_entry * parent = zend_hash_find_ptr (EG (class_table ), key );
3853+ const zend_class_entry * parent = zend_hash_find_ptr (EG (class_table ), key );
38543854 zend_string_release (key );
38553855 if (!parent ) {
38563856 error -> kind = "Unknown parent " ;
@@ -3861,7 +3861,7 @@ static zend_result preload_resolve_deps(preload_error *error, const zend_class_e
38613861
38623862 if (ce -> num_interfaces ) {
38633863 for (uint32_t i = 0 ; i < ce -> num_interfaces ; i ++ ) {
3864- zend_class_entry * interface =
3864+ const zend_class_entry * interface =
38653865 zend_hash_find_ptr (EG (class_table ), ce -> interface_names [i ].lc_name );
38663866 if (!interface ) {
38673867 error -> kind = "Unknown interface " ;
@@ -3873,7 +3873,7 @@ static zend_result preload_resolve_deps(preload_error *error, const zend_class_e
38733873
38743874 if (ce -> num_traits ) {
38753875 for (uint32_t i = 0 ; i < ce -> num_traits ; i ++ ) {
3876- zend_class_entry * trait =
3876+ const zend_class_entry * trait =
38773877 zend_hash_find_ptr (EG (class_table ), ce -> trait_names [i ].lc_name );
38783878 if (!trait ) {
38793879 error -> kind = "Unknown trait " ;
@@ -3978,7 +3978,7 @@ static void preload_error_cb(int type, zend_string *error_filename, const uint32
39783978static void preload_remove_declares (zend_op_array * op_array )
39793979{
39803980 zend_op * opline = op_array -> opcodes ;
3981- zend_op * end = opline + op_array -> last ;
3981+ const zend_op * end = opline + op_array -> last ;
39823982 uint32_t skip_dynamic_func_count = 0 ;
39833983 zend_string * key ;
39843984 zend_op_array * func ;
@@ -4269,7 +4269,7 @@ static void preload_remove_empty_includes(void)
42694269 if (script -> empty ) {
42704270 bool empty = true;
42714271 zend_op * opline = script -> script .main_op_array .opcodes ;
4272- zend_op * end = opline + script -> script .main_op_array .last ;
4272+ const zend_op * end = opline + script -> script .main_op_array .last ;
42734273
42744274 while (opline < end ) {
42754275 if (opline -> opcode == ZEND_INCLUDE_OR_EVAL &&
@@ -4310,7 +4310,7 @@ static void preload_remove_empty_includes(void)
43104310 /* remove empty includes */
43114311 ZEND_HASH_MAP_FOREACH_PTR (preload_scripts , script ) {
43124312 zend_op * opline = script -> script .main_op_array .opcodes ;
4313- zend_op * end = opline + script -> script .main_op_array .last ;
4313+ const zend_op * end = opline + script -> script .main_op_array .last ;
43144314
43154315 while (opline < end ) {
43164316 if (opline -> opcode == ZEND_INCLUDE_OR_EVAL &&
@@ -4321,7 +4321,7 @@ static void preload_remove_empty_includes(void)
43214321 zend_string * resolved_path = preload_resolve_path (Z_STR_P (RT_CONSTANT (opline , opline -> op1 )));
43224322
43234323 if (resolved_path ) {
4324- zend_persistent_script * incl = zend_hash_find_ptr (preload_scripts , resolved_path );
4324+ const zend_persistent_script * incl = zend_hash_find_ptr (preload_scripts , resolved_path );
43254325 if (incl && incl -> empty && opline -> result_type == IS_UNUSED ) {
43264326 MAKE_NOP (opline );
43274327 } else {
@@ -4339,7 +4339,7 @@ static void preload_remove_empty_includes(void)
43394339 } ZEND_HASH_FOREACH_END ();
43404340}
43414341
4342- static void preload_register_trait_methods (zend_class_entry * ce ) {
4342+ static void preload_register_trait_methods (const zend_class_entry * ce ) {
43434343 zend_op_array * op_array ;
43444344
43454345 ZEND_HASH_MAP_FOREACH_PTR (& ce -> function_table , op_array ) {
@@ -4372,7 +4372,7 @@ static void preload_fix_trait_op_array(zend_op_array *op_array)
43724372 return ;
43734373 }
43744374
4375- zend_op_array * orig_op_array = zend_shared_alloc_get_xlat_entry (op_array -> refcount );
4375+ const zend_op_array * orig_op_array = zend_shared_alloc_get_xlat_entry (op_array -> refcount );
43764376 ZEND_ASSERT (orig_op_array && "Must be in xlat table" );
43774377
43784378 zend_string * function_name = op_array -> function_name ;
@@ -4390,7 +4390,7 @@ static void preload_fix_trait_op_array(zend_op_array *op_array)
43904390 op_array -> static_variables = ht ;
43914391}
43924392
4393- static void preload_fix_trait_methods (zend_class_entry * ce )
4393+ static void preload_fix_trait_methods (const zend_class_entry * ce )
43944394{
43954395 zend_op_array * op_array ;
43964396
@@ -4415,7 +4415,7 @@ static void preload_fix_trait_methods(zend_class_entry *ce)
44154415
44164416static void preload_optimize (zend_persistent_script * script )
44174417{
4418- zend_class_entry * ce ;
4418+ const zend_class_entry * ce ;
44194419 zend_persistent_script * tmp_script ;
44204420
44214421 zend_shared_alloc_init_xlat_table ();
@@ -4512,10 +4512,10 @@ static zend_persistent_script* preload_script_in_shared_memory(zend_persistent_s
45124512static void preload_load (size_t orig_map_ptr_static_last )
45134513{
45144514 /* Load into process tables */
4515- zend_script * script = & ZCSG (preload_script )-> script ;
4515+ const zend_script * script = & ZCSG (preload_script )-> script ;
45164516 if (zend_hash_num_elements (& script -> function_table )) {
45174517 Bucket * p = script -> function_table .arData ;
4518- Bucket * end = p + script -> function_table .nNumUsed ;
4518+ const Bucket * end = p + script -> function_table .nNumUsed ;
45194519
45204520 zend_hash_extend (CG (function_table ),
45214521 CG (function_table )-> nNumUsed + script -> function_table .nNumUsed , 0 );
@@ -4526,7 +4526,7 @@ static void preload_load(size_t orig_map_ptr_static_last)
45264526
45274527 if (zend_hash_num_elements (& script -> class_table )) {
45284528 Bucket * p = script -> class_table .arData ;
4529- Bucket * end = p + script -> class_table .nNumUsed ;
4529+ const Bucket * end = p + script -> class_table .nNumUsed ;
45304530
45314531 zend_hash_extend (CG (class_table ),
45324532 CG (class_table )-> nNumUsed + script -> class_table .nNumUsed , 0 );
@@ -4574,7 +4574,7 @@ static void preload_load(size_t orig_map_ptr_static_last)
45744574}
45754575
45764576#if HAVE_JIT
4577- static void zend_accel_clear_call_graph_ptrs (zend_op_array * op_array )
4577+ static void zend_accel_clear_call_graph_ptrs (const zend_op_array * op_array )
45784578{
45794579 ZEND_ASSERT (ZEND_USER_CODE (op_array -> type ));
45804580 zend_func_info * info = ZEND_FUNC_INFO (op_array );
@@ -4584,9 +4584,9 @@ static void zend_accel_clear_call_graph_ptrs(zend_op_array *op_array)
45844584 }
45854585}
45864586
4587- static void accel_reset_arena_info (zend_persistent_script * script )
4587+ static void accel_reset_arena_info (const zend_persistent_script * script )
45884588{
4589- zend_op_array * op_array ;
4589+ const zend_op_array * op_array ;
45904590 zend_class_entry * ce ;
45914591
45924592 zend_accel_clear_call_graph_ptrs (& script -> script .main_op_array );
0 commit comments