diff --git a/ext/opcache/zend_accelerator_blacklist.c b/ext/opcache/zend_accelerator_blacklist.c index 4c0e2f6c5a18..631f8b34608f 100644 --- a/ext/opcache/zend_accelerator_blacklist.c +++ b/ext/opcache/zend_accelerator_blacklist.c @@ -205,7 +205,7 @@ void zend_accel_blacklist_shutdown(zend_blacklist *blacklist) return; } - zend_blacklist_entry *p = blacklist->entries, *end = blacklist->entries + blacklist->pos; + const zend_blacklist_entry *p = blacklist->entries, *end = blacklist->entries + blacklist->pos; while (ppath); p++; @@ -336,10 +336,10 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename) zend_accel_blacklist_update_regexp(blacklist); } -bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *verify_path, size_t verify_path_len) +bool zend_accel_blacklist_is_blacklisted(const zend_blacklist *blacklist, const char *verify_path, size_t verify_path_len) { int ret = 0; - zend_regexp_list *regexp_list_it = blacklist->regexp_list; + const zend_regexp_list *regexp_list_it = blacklist->regexp_list; pcre2_match_context *mctx = php_pcre_mctx(); if (regexp_list_it == NULL) { @@ -363,7 +363,7 @@ bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *verify return ret; } -void zend_accel_blacklist_apply(zend_blacklist *blacklist, blacklist_apply_func_arg_t func, void *argument) +void zend_accel_blacklist_apply(const zend_blacklist *blacklist, blacklist_apply_func_arg_t func, void *argument) { int i; diff --git a/ext/opcache/zend_accelerator_blacklist.h b/ext/opcache/zend_accelerator_blacklist.h index 2a7921f63d94..da6e04e31b7c 100644 --- a/ext/opcache/zend_accelerator_blacklist.h +++ b/ext/opcache/zend_accelerator_blacklist.h @@ -45,7 +45,7 @@ void zend_accel_blacklist_init(zend_blacklist *blacklist); void zend_accel_blacklist_shutdown(zend_blacklist *blacklist); void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename); -bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *verify_path, size_t verify_path_len); -void zend_accel_blacklist_apply(zend_blacklist *blacklist, blacklist_apply_func_arg_t func, void *argument); +bool zend_accel_blacklist_is_blacklisted(const zend_blacklist *blacklist, const char *verify_path, size_t verify_path_len); +void zend_accel_blacklist_apply(const zend_blacklist *blacklist, blacklist_apply_func_arg_t func, void *argument); #endif /* ZEND_ACCELERATOR_BLACKLIST_H */ diff --git a/ext/opcache/zend_accelerator_hash.c b/ext/opcache/zend_accelerator_hash.c index 2fd3dfb5ed56..5198c0b3b78c 100644 --- a/ext/opcache/zend_accelerator_hash.c +++ b/ext/opcache/zend_accelerator_hash.c @@ -138,7 +138,7 @@ zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, zend_ return entry; } -static zend_always_inline void* zend_accel_hash_find_ex(zend_accel_hash *accel_hash, zend_string *key, int data) +static zend_always_inline void* zend_accel_hash_find_ex(const zend_accel_hash *accel_hash, zend_string *key, bool data) { zend_ulong index; zend_accel_hash_entry *entry; @@ -176,20 +176,20 @@ static zend_always_inline void* zend_accel_hash_find_ex(zend_accel_hash *accel_h /* Returns the data associated with key on success * Returns NULL if data doesn't exist */ -void* zend_accel_hash_find(zend_accel_hash *accel_hash, zend_string *key) +void* zend_accel_hash_find(const zend_accel_hash *accel_hash, zend_string *key) { - return zend_accel_hash_find_ex(accel_hash, key, 1); + return zend_accel_hash_find_ex(accel_hash, key, true); } /* Returns the hash entry associated with key on success * Returns NULL if it doesn't exist */ -zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, zend_string *key) +zend_accel_hash_entry* zend_accel_hash_find_entry(const zend_accel_hash *accel_hash, zend_string *key) { - return (zend_accel_hash_entry *)zend_accel_hash_find_ex(accel_hash, key, 0); + return (zend_accel_hash_entry *)zend_accel_hash_find_ex(accel_hash, key, false); } -int zend_accel_hash_unlink(zend_accel_hash *accel_hash, zend_string *key) +zend_result zend_accel_hash_unlink(zend_accel_hash *accel_hash, zend_string *key) { zend_ulong hash_value; zend_ulong index; diff --git a/ext/opcache/zend_accelerator_hash.h b/ext/opcache/zend_accelerator_hash.h index 6aa6ba7b8019..2f9197385386 100644 --- a/ext/opcache/zend_accelerator_hash.h +++ b/ext/opcache/zend_accelerator_hash.h @@ -72,18 +72,18 @@ zend_accel_hash_entry* zend_accel_hash_update( void *data); void* zend_accel_hash_find( - zend_accel_hash *accel_hash, + const zend_accel_hash *accel_hash, zend_string *key); zend_accel_hash_entry* zend_accel_hash_find_entry( - zend_accel_hash *accel_hash, + const zend_accel_hash *accel_hash, zend_string *key); -int zend_accel_hash_unlink( +zend_result zend_accel_hash_unlink( zend_accel_hash *accel_hash, zend_string *key); -static inline bool zend_accel_hash_is_full(zend_accel_hash *accel_hash) +static inline bool zend_accel_hash_is_full(const zend_accel_hash *accel_hash) { if (accel_hash->num_entries == accel_hash->max_num_entries) { return true; diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 32d9354c1e6d..a2569e07f14c 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -34,7 +34,6 @@ #include "SAPI.h" #include "zend_virtual_cwd.h" #include "ext/standard/info.h" -#include "ext/standard/php_filestat.h" #include "ext/date/php_date.h" #include "opcache_arginfo.h" @@ -62,7 +61,7 @@ static zif_handler orig_file_exists = NULL; static zif_handler orig_is_file = NULL; static zif_handler orig_is_readable = NULL; -static int validate_api_restriction(void) +static bool validate_api_restriction(void) { if (ZCG(accel_directives).restrict_api && *ZCG(accel_directives).restrict_api) { size_t len = strlen(ZCG(accel_directives).restrict_api); @@ -71,10 +70,10 @@ static int validate_api_restriction(void) strlen(SG(request_info).path_translated) < len || memcmp(SG(request_info).path_translated, ZCG(accel_directives).restrict_api, len) != 0) { zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " API is restricted by \"restrict_api\" configuration directive"); - return 0; + return false; } } - return 1; + return true; } static ZEND_INI_MH(OnUpdateMemoryConsumption) @@ -178,8 +177,8 @@ static ZEND_INI_MH(OnEnable) } return FAILURE; } else { - *p = 0; - ZCG(accelerator_enabled) = 0; + *p = false; + ZCG(accelerator_enabled) = false; return SUCCESS; } } @@ -363,7 +362,7 @@ ZEND_INI_BEGIN() #endif ZEND_INI_END() -static int filename_is_in_cache(zend_string *filename) +static bool filename_is_in_cache(zend_string *filename) { zend_string *key; @@ -373,27 +372,26 @@ static int filename_is_in_cache(zend_string *filename) if (persistent_script && !persistent_script->corrupted) { if (ZCG(accel_directives).validate_timestamps) { zend_file_handle handle; - int ret; + bool ret; zend_stream_init_filename_ex(&handle, filename); - ret = validate_timestamp_and_record_ex(persistent_script, &handle) == SUCCESS - ? 1 : 0; + ret = validate_timestamp_and_record_ex(persistent_script, &handle) == SUCCESS; zend_destroy_file_handle(&handle); return ret; } - return 1; + return true; } } - return 0; + return false; } -static int filename_is_in_file_cache(zend_string *filename) +static bool filename_is_in_file_cache(zend_string *filename) { zend_string *realpath = zend_resolve_path(filename); if (!realpath) { - return 0; + return false; } zend_file_handle handle; @@ -406,7 +404,7 @@ static int filename_is_in_file_cache(zend_string *filename) return result != NULL; } -static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS) +static bool accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS) { if (ZEND_NUM_ARGS() == 1) { zval *zv = ZEND_CALL_ARG(execute_data , 1); @@ -415,7 +413,7 @@ static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS) return filename_is_in_cache(Z_STR_P(zv)); } } - return 0; + return false; } static ZEND_NAMED_FUNCTION(accel_file_exists) @@ -947,11 +945,7 @@ ZEND_FUNCTION(opcache_invalidate) RETURN_FALSE; } - if (zend_accel_invalidate(script_name, force) == SUCCESS) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } + RETURN_BOOL(zend_accel_invalidate(script_name, force) == SUCCESS); } /* {{{ Prevents JIT on function. Call it before the first invocation of the given function. */ diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index dc84f879d8d4..2de7854fb14c 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -47,7 +47,7 @@ zend_persistent_script* create_persistent_script(void) return persistent_script; } -void free_persistent_script(zend_persistent_script *persistent_script, int destroy_elements) +void free_persistent_script(zend_persistent_script *persistent_script, bool destroy_elements) { if (!destroy_elements) { /* Both the keys and values have been transferred into the global tables. @@ -105,7 +105,7 @@ void zend_accel_move_user_classes(HashTable *src, uint32_t count, zend_script *s { Bucket *p, *end; HashTable *dst; - zend_string *filename; + const zend_string *filename; dtor_func_t orig_dtor; zend_class_entry *ce; @@ -132,10 +132,10 @@ void zend_accel_move_user_classes(HashTable *src, uint32_t count, zend_script *s src->pDestructor = orig_dtor; } -static zend_always_inline void _zend_accel_function_hash_copy(HashTable *target, HashTable *source, bool call_observers) +static zend_always_inline void _zend_accel_function_hash_copy(HashTable *target, const HashTable *source, bool call_observers) { zend_function *function1, *function2; - Bucket *p, *end; + const Bucket *p, *end; zval *t; zend_hash_extend(target, target->nNumUsed + source->nNumUsed, 0); @@ -174,20 +174,20 @@ static zend_always_inline void _zend_accel_function_hash_copy(HashTable *target, } } -static zend_always_inline void zend_accel_function_hash_copy(HashTable *target, HashTable *source) +static zend_always_inline void zend_accel_function_hash_copy(HashTable *target, const HashTable *source) { _zend_accel_function_hash_copy(target, source, false); } -static zend_never_inline void zend_accel_function_hash_copy_notify(HashTable *target, HashTable *source) +static zend_never_inline void zend_accel_function_hash_copy_notify(HashTable *target, const HashTable *source) { _zend_accel_function_hash_copy(target, source, true); } -static zend_always_inline void _zend_accel_class_hash_copy(HashTable *target, HashTable *source, bool call_observers) +static zend_always_inline void _zend_accel_class_hash_copy(HashTable *target, const HashTable *source, bool call_observers) { - Bucket *p, *end; - zval *t; + const Bucket *p, *end; + const zval *t; zend_hash_extend(target, target->nNumUsed + source->nNumUsed, 0); p = source->arData; @@ -209,7 +209,7 @@ static zend_always_inline void _zend_accel_class_hash_copy(HashTable *target, Ha * value. */ continue; } else if (UNEXPECTED(!ZCG(accel_directives).ignore_dups)) { - zend_class_entry *ce1 = Z_PTR(p->val); + const zend_class_entry *ce1 = Z_PTR(p->val); if (!(ce1->ce_flags & ZEND_ACC_ANON_CLASS)) { CG(in_compilation) = 1; zend_set_compiled_filename(ce1->info.user.filename); @@ -235,25 +235,25 @@ static zend_always_inline void _zend_accel_class_hash_copy(HashTable *target, Ha target->nInternalPointer = 0; } -static zend_always_inline void zend_accel_class_hash_copy(HashTable *target, HashTable *source) +static zend_always_inline void zend_accel_class_hash_copy(HashTable *target, const HashTable *source) { _zend_accel_class_hash_copy(target, source, false); } -static zend_never_inline void zend_accel_class_hash_copy_notify(HashTable *target, HashTable *source) +static zend_never_inline void zend_accel_class_hash_copy_notify(HashTable *target, const HashTable *source) { _zend_accel_class_hash_copy(target, source, true); } void zend_accel_build_delayed_early_binding_list(zend_persistent_script *persistent_script) { - zend_op_array *op_array = &persistent_script->script.main_op_array; + const zend_op_array *op_array = &persistent_script->script.main_op_array; if (!(op_array->fn_flags & ZEND_ACC_EARLY_BINDING)) { return; } - zend_op *end = op_array->opcodes + op_array->last; - for (zend_op *opline = op_array->opcodes; opline < end; opline++) { + const zend_op *end = op_array->opcodes + op_array->last; + for (const zend_op *opline = op_array->opcodes; opline < end; opline++) { if (opline->opcode == ZEND_DECLARE_CLASS_DELAYED) { persistent_script->num_early_bindings++; } @@ -264,7 +264,7 @@ void zend_accel_build_delayed_early_binding_list(zend_persistent_script *persist for (zend_op *opline = op_array->opcodes; opline < end; opline++) { if (opline->opcode == ZEND_DECLARE_CLASS_DELAYED) { - zval *lcname = RT_CONSTANT(opline, opline->op1); + const zval *lcname = RT_CONSTANT(opline, opline->op1); early_binding->lcname = zend_string_copy(Z_STR_P(lcname)); early_binding->rtd_key = zend_string_copy(Z_STR_P(lcname + 1)); early_binding->lc_parent_name = @@ -275,19 +275,19 @@ void zend_accel_build_delayed_early_binding_list(zend_persistent_script *persist } } -void zend_accel_finalize_delayed_early_binding_list(zend_persistent_script *persistent_script) +void zend_accel_finalize_delayed_early_binding_list(const zend_persistent_script *persistent_script) { if (!persistent_script->num_early_bindings) { return; } zend_early_binding *early_binding = persistent_script->early_bindings; - zend_early_binding *early_binding_end = early_binding + persistent_script->num_early_bindings; - zend_op_array *op_array = &persistent_script->script.main_op_array; - zend_op *opline_end = op_array->opcodes + op_array->last; + const zend_early_binding *early_binding_end = early_binding + persistent_script->num_early_bindings; + const zend_op_array *op_array = &persistent_script->script.main_op_array; + const zend_op *opline_end = op_array->opcodes + op_array->last; for (zend_op *opline = op_array->opcodes; opline < opline_end; opline++) { if (opline->opcode == ZEND_DECLARE_CLASS_DELAYED) { - zend_string *rtd_key = Z_STR_P(RT_CONSTANT(opline, opline->op1) + 1); + const zend_string *rtd_key = Z_STR_P(RT_CONSTANT(opline, opline->op1) + 1); /* Skip early_binding entries that don't match, maybe their DECLARE_CLASS_DELAYED * was optimized away. */ while (!zend_string_equals(early_binding->rtd_key, rtd_key)) { @@ -310,7 +310,7 @@ void zend_accel_free_delayed_early_binding_list(zend_persistent_script *persiste { if (persistent_script->num_early_bindings) { for (uint32_t i = 0; i < persistent_script->num_early_bindings; i++) { - zend_early_binding *early_binding = &persistent_script->early_bindings[i]; + const zend_early_binding *early_binding = &persistent_script->early_bindings[i]; zend_string_release(early_binding->lcname); zend_string_release(early_binding->rtd_key); zend_string_release(early_binding->lc_parent_name); @@ -322,7 +322,7 @@ void zend_accel_free_delayed_early_binding_list(zend_persistent_script *persiste } static void zend_accel_do_delayed_early_binding( - zend_persistent_script *persistent_script, zend_op_array *op_array) + const zend_persistent_script *persistent_script, zend_op_array *op_array) { ZEND_ASSERT(!ZEND_MAP_PTR(op_array->run_time_cache)); ZEND_ASSERT(op_array->fn_flags & ZEND_ACC_HEAP_RT_CACHE); @@ -336,7 +336,7 @@ static void zend_accel_do_delayed_early_binding( CG(compiled_filename) = persistent_script->script.filename; CG(in_compilation) = 1; for (uint32_t i = 0; i < persistent_script->num_early_bindings; i++) { - zend_early_binding *early_binding = &persistent_script->early_bindings[i]; + const zend_early_binding *early_binding = &persistent_script->early_bindings[i]; zend_class_entry *ce = zend_hash_find_ex_ptr(EG(class_table), early_binding->lcname, 1); if (!ce) { zval *zv = zend_hash_find_known_hash(EG(class_table), early_binding->rtd_key); @@ -358,7 +358,7 @@ static void zend_accel_do_delayed_early_binding( CG(in_compilation) = orig_in_compilation; } -zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, int from_shared_memory) +zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, bool from_shared_memory) { zend_op_array *op_array; @@ -448,7 +448,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, #define ADLER32_SCALAR_DO8(buf, i) ADLER32_SCALAR_DO4(buf, i); ADLER32_SCALAR_DO4(buf, i + 4); #define ADLER32_SCALAR_DO16(buf) ADLER32_SCALAR_DO8(buf, 0); ADLER32_SCALAR_DO8(buf, 8); -static zend_always_inline void adler32_do16_loop(unsigned char *buf, unsigned char *end, unsigned int *s1_out, unsigned int *s2_out) +static zend_always_inline void adler32_do16_loop(unsigned char *buf, const unsigned char *end, unsigned int *s1_out, unsigned int *s2_out) { unsigned int s1 = *s1_out; unsigned int s2 = *s2_out; diff --git a/ext/opcache/zend_accelerator_util_funcs.h b/ext/opcache/zend_accelerator_util_funcs.h index 53cc1de9effa..fa248edeef55 100644 --- a/ext/opcache/zend_accelerator_util_funcs.h +++ b/ext/opcache/zend_accelerator_util_funcs.h @@ -28,15 +28,15 @@ BEGIN_EXTERN_C() zend_persistent_script* create_persistent_script(void); -void free_persistent_script(zend_persistent_script *persistent_script, int destroy_elements); +void free_persistent_script(zend_persistent_script *persistent_script, bool destroy_elements); void zend_accel_move_user_functions(HashTable *str, uint32_t count, zend_script *script); void zend_accel_move_user_classes(HashTable *str, uint32_t count, zend_script *script); void zend_accel_build_delayed_early_binding_list(zend_persistent_script *persistent_script); -void zend_accel_finalize_delayed_early_binding_list(zend_persistent_script *persistent_script); +void zend_accel_finalize_delayed_early_binding_list(const zend_persistent_script *persistent_script); void zend_accel_free_delayed_early_binding_list(zend_persistent_script *persistent_script); -zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, int from_shared_memory); +zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, bool from_shared_memory); #define ADLER32_INIT 1 /* initial Adler-32 value */ diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 38e58d5a1663..e1187b045b13 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -732,7 +732,7 @@ static void zend_persist_op_array(zval *zv) } } -static zend_op_array *zend_persist_class_method(zend_op_array *op_array, zend_class_entry *ce) +static zend_op_array *zend_persist_class_method(zend_op_array *op_array, const zend_class_entry *ce) { zend_op_array *old_op_array; @@ -834,7 +834,7 @@ static zend_property_info *zend_persist_property_info(zend_property_info *prop) prop->attributes = zend_persist_attributes(prop->attributes); } if (prop->prototype) { - zend_property_info *new_prototype = (zend_property_info *) zend_shared_alloc_get_xlat_entry(prop->prototype); + const zend_property_info *new_prototype = (const zend_property_info *) zend_shared_alloc_get_xlat_entry(prop->prototype); if (new_prototype) { prop->prototype = new_prototype; } @@ -854,7 +854,7 @@ static zend_property_info *zend_persist_property_info(zend_property_info *prop) } } #endif - zend_property_info *new_prop_info = (zend_property_info *) zend_shared_alloc_get_xlat_entry(hook->prop_info); + const zend_property_info *new_prop_info = (const zend_property_info *) zend_shared_alloc_get_xlat_entry(hook->prop_info); if (new_prop_info) { hook->prop_info = new_prop_info; } @@ -868,7 +868,7 @@ static zend_property_info *zend_persist_property_info(zend_property_info *prop) static void zend_persist_class_constant(zval *zv) { - zend_class_constant *orig_c = Z_PTR_P(zv); + const zend_class_constant *orig_c = Z_PTR_P(zv); zend_class_constant *c = zend_shared_alloc_get_xlat_entry(orig_c); zend_class_entry *ce; @@ -1287,7 +1287,7 @@ void zend_update_parent_ce(zend_class_entry *ce) } #ifdef HAVE_JIT -static void zend_accel_persist_jit_op_array(zend_op_array *op_array, zend_class_entry *ce) +static void zend_accel_persist_jit_op_array(zend_op_array *op_array, const zend_class_entry *ce) { if (op_array->type == ZEND_USER_FUNCTION) { if (op_array->scope == ce @@ -1301,7 +1301,7 @@ static void zend_accel_persist_jit_op_array(zend_op_array *op_array, zend_class_ } } -static void zend_accel_persist_link_func_info(zend_op_array *op_array, zend_class_entry *ce) +static void zend_accel_persist_link_func_info(zend_op_array *op_array, const zend_class_entry *ce) { if (op_array->type == ZEND_USER_FUNCTION && !(op_array->fn_flags & ZEND_ACC_ABSTRACT)) { @@ -1421,7 +1421,7 @@ static zend_early_binding *zend_persist_early_bindings( return early_bindings; } -zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, int for_shm) +zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, bool for_shm) { Bucket *p; diff --git a/ext/opcache/zend_persist.h b/ext/opcache/zend_persist.h index 930430c9589b..c8220217630e 100644 --- a/ext/opcache/zend_persist.h +++ b/ext/opcache/zend_persist.h @@ -24,8 +24,8 @@ BEGIN_EXTERN_C() -uint32_t zend_accel_script_persist_calc(zend_persistent_script *script, int for_shm); -zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, int for_shm); +uint32_t zend_accel_script_persist_calc(zend_persistent_script *script, bool for_shm); +zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, bool for_shm); void zend_persist_class_entry_calc(zend_class_entry *ce); zend_class_entry *zend_persist_class_entry(zend_class_entry *ce); diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 106a69f5dd38..3c763d239e5f 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -47,9 +47,9 @@ } while (0) static void zend_persist_zval_calc(zval *z); -static void zend_persist_op_array_calc(zval *zv); +static void zend_persist_op_array_calc(const zval *zv); -static void zend_hash_persist_calc(HashTable *ht) +static void zend_hash_persist_calc(const HashTable *ht) { if ((HT_FLAGS(ht) & HASH_FLAG_UNINITIALIZED) || ht->nNumUsed == 0) { return; @@ -79,7 +79,7 @@ static void zend_persist_ast_calc(zend_ast *ast) ADD_SIZE(sizeof(zend_ast_zval)); zend_persist_zval_calc(&((zend_ast_zval*)(ast))->val); } else if (zend_ast_is_list(ast)) { - zend_ast_list *list = zend_ast_get_list(ast); + const zend_ast_list *list = zend_ast_get_list(ast); ADD_SIZE(sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * list->children); for (i = 0; i < list->children; i++) { if (list->child[i]) { @@ -125,7 +125,7 @@ static void zend_persist_zval_calc(zval *z) } size = zend_shared_memdup_size(Z_ARR_P(z), sizeof(zend_array)); if (size) { - HashTable *ht = Z_ARRVAL_P(z); + const HashTable *ht = Z_ARRVAL_P(z); ADD_SIZE(size); zend_hash_persist_calc(ht); @@ -218,7 +218,7 @@ static void zend_persist_type_calc(zend_type *type) static void zend_persist_op_array_calc_ex(zend_op_array *op_array) { if (op_array->function_name) { - zend_string *old_name = op_array->function_name; + const zend_string *old_name = op_array->function_name; ADD_INTERNED_STRING(op_array->function_name); /* Remember old function name, so it can be released multiple times if shared. */ if (op_array->function_name != old_name @@ -258,7 +258,7 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array) if (op_array->literals) { zval *p = op_array->literals; - zval *end = p + op_array->last_literal; + const zval *end = p + op_array->last_literal; ADD_SIZE(sizeof(zval) * op_array->last_literal); while (p < end) { zend_persist_zval_calc(p); @@ -272,7 +272,7 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array) /* ZEND_ACC_PTR_OPS and ZEND_ACC_OVERRIDE use the same value */ if ((op_array->fn_flags & ZEND_ACC_PTR_OPS) && !op_array->function_name) { zend_op *op = op_array->opcodes; - zend_op *end = op + op_array->last; + const zend_op *end = op + op_array->last; while (op < end) { if (op->opcode == ZEND_DECLARE_ATTRIBUTED_CONST) { HashTable *attributes = Z_PTR_P(RT_CONSTANT(op+1, (op+1)->op1)); @@ -344,7 +344,7 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array) ADD_SIZE(ZEND_ALIGNED_SIZE(zend_extensions_op_array_persist_calc(op_array))); } -static void zend_persist_op_array_calc(zval *zv) +static void zend_persist_op_array_calc(const zval *zv) { zend_op_array *op_array = Z_PTR_P(zv); ZEND_ASSERT(op_array->type == ZEND_USER_FUNCTION); @@ -417,7 +417,7 @@ static void zend_persist_property_info_calc(zend_property_info *prop) } } -static void zend_persist_class_constant_calc(zval *zv) +static void zend_persist_class_constant_calc(const zval *zv) { zend_class_constant *c = Z_PTR_P(zv); @@ -596,7 +596,7 @@ void zend_persist_class_entry_calc(zend_class_entry *ce) } } -static void zend_accel_persist_class_table_calc(HashTable *class_table) +static void zend_accel_persist_class_table_calc(const HashTable *class_table) { Bucket *p; @@ -629,7 +629,7 @@ static void zend_persist_early_bindings_calc( } } -uint32_t zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, int for_shm) +uint32_t zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, bool for_shm) { Bucket *p;