diff options
81 files changed, 1064 insertions, 908 deletions
diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 404f5f9c67..301faf16cd 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -158,6 +158,28 @@ PHP 8.0 INTERNALS UPGRADE NOTES - zend_fcall_info_argp() - zend_fcall_info_argv() - zend_fcall_info_argn() + - zend_startup() + - zend_set_memory_limit() + - pass_two() + - zend_startup_constants() + - zend_shutdown_constants() + - zend_startup_extensions_mechanism() + - zend_startup_extensions() + - zend_register_extension() + - highlight_string() + - zend_ini_startup() + - zend_ini_shutdown() + - zend_ini_global_shutdown() + - zend_ini_deactivate() + - zend_copy_ini_directives() + - zend_prepare_string_for_scanning() + - zend_init_rsrc_list() + - zend_list_close() + - zend_signal() + - zend_sigaction() + - zend_stack_init() + - zend_stack_del_top() + - zend_stack_destroy() 2. Argument int to uint32_t in Zend Engine 4.0: - _zend_get_parameters_array_ex() - zend_copy_parameters_array() @@ -169,8 +191,39 @@ PHP 8.0 INTERNALS UPGRADE NOTES - zend_wrong_parameter*() - zend_wrong_callback_error() - zend_parse_arg_class() - 3. Argument int to zend_bool in Zend Engine 4.0: + 3. Argument int to bool in Zend Engine 4.0: - add_next_index_bool() + - zend_register_class_alias_ex() + - add_assoc_bool_ex() + - add_index_bool() + - zend_fcall_info_args_clear() + - zend_set_local_var() + - zend_set_local_var_str() + - zend_parse_arg_*() + - shutdown_memory_manager() + - zend_memory_usage() + - zend_memory_peak_usage() + - zend_mm_shutdown() + - zend_eval_string*() + - zend_set_timeout() + - _zend_hash_append_ex() + - _zend_hash_append_ptr_ex() + - zend_alter_ini_entry_ex() + - (*zend_encoding_list_parser) typedef + - zend_multibyte_parse_encoding_list() + - zend_safe_address() + - zend_string_tolower_ex() + - zend_string_alloc() + - zend_string_safe_alloc() + - zend_string_init() + - zend_string_dup() + - zend_string_realloc() + - zend_string_extend() + - zend_string_truncate() + - zend_string_safe_realloc() + - zend_string_release_ex() + - zend_ts_hash_merge() + - zend_ts_hash_sort() 4. Argument int to size_t in Zend Engine 4.0: - zend_set_hash_symbol() 5. Argument zval* to zend_object* in Zend Engine 4.0: @@ -185,6 +238,135 @@ PHP 8.0 INTERNALS UPGRADE NOTES - zend_get_exception_base() 6. Argument zval* to zend_long in Zend Engine 4.0: - _php_math_longtobase() + 7. Return type from int to zend_result in Zend Engine 4.0: + - (*stream_open_function) in _zend_utility_functions + - (*zend_post_startup_cb) + - (*zend_preload_autoload) + - zend_execute_scripts() + - zend_post_startup() + - _zend_get_parameters_array_ex() + - zend_copy_parameters_array() + - zend_parse_parameters() + - zend_parse_parameters_ex() + - zend_parse_method_parameters() + - zend_parse_method_parameters_ex() + - zend_parse_method_parameters() + - zend_register_functions() + - zend_startup_module() + - zend_startup_module_ex() + - zend_register_class_alias_ex() + - zend_disable_function() + - zend_disable_class() + - zend_update_class_constants() + - zend_update_static_property*() + - object_init_ex() + - object_and_properties_init() + - add_index_zval() + - add_next_index_long_*() + - array_set_zval_key() + - _call_user_function_impl() + - zend_fcall_info_*() + - zend_call_function() + - zend_set_hash_symbol() + - zend_delete_global_variable() + - zend_set_local_var() + - zend_set_local_var_str() + - zend_forbid_dynamic_call() + - zend_get_default_from_internal_arg_info() + - zend_try_assign_typed_ref*() + - zend_ast_evaluate() + - zend_startup_builtin_functions() + - do_bind_function() + - do_bind_class() + - zend_unmangle_property_name_ex() + - zend_register_auto_global() + - zend_register_constant() + - zend_exception_error() + - zend_eval_string*() + - zend_undefined_offset_write() + - zend_undefined_index_write() + - zval_update_constant(_ex)() + - zend_load_extension() + - zend_load_extension_handle() + - zend_hash_del(_ind)() + - zend_hash_str_del(_ind)() + - zend_hash_index_del() + - zend_hash_move_forward_ex() + - zend_hash_move_backward_ex() + - zend_hash_get_current_key_ex() + - zend_hash_get_current_key_type_ex() + - zend_symtable_del(_ind)() + - zend_symtable_str_del(_ind)() + - highlight_file() + - zend_do_link_class() + - zend_alter_ini_entry*() + - zend_restore_ini_entry() + - zend_ini_register_displayer() + - zend_ini_open_file_for_scanning() + - zend_ini_prepare_string_for_scanning() + - zend_user_it_valid() + - zend_create_internal_iterator_zval() + - zend_multibyte_set_filter() + - zend_lex_tstring() + - _zend_module_entry module_startup_func, module_shutdown_func, + request_startup_func, and request_shutdown_func function pointers + - (*zend_encoding_list_parser) typedef + - (*zend_encoding_internal_encoding_setter) typedef + - zend_multibyte_set_functions() + - zend_multibyte_set_script_encoding_by_string() + - add_function() + - sub_function() + - mul_function() + - pow_function() + - div_function() + - mod_function() + - boolean_xor_function() + - boolean_not_function() + - bitwise_not_function() + - bitwise_or_function() + - bitwise_and_function() + - bitwise_xor_function() + - shift_left_function() + - shift_right_function() + - concat_function() + - is_equal_function( + - is_identical_function() + - is_not_identical_function() + - is_not_equal_function() + - is_smaller_function() + - is_smaller_or_equal_function(zv + - increment_function() + - decrement_function() + - zend_stream_open() + - zend_stream_fixup() + - zend_ts_hash_del() + - zend_ts_hash_index_del() + 8. Return type from int to bool in Zend Engine 4.0: + - zend_make_printable_zval() + - zend_parse_arg_*() + - is_zend_mm() + - is_zend_ptr() + - zend_mm_is_custom_heap() + - (*zend_mm_chunk_truncate_t) + - (*zend_mm_chunk_extend_t) + - zend_bitset_empty() + - zend_is_smart_branch() + - zend_check_arg_send_type() + - zend_verify_const_access() + - zend_gdb_register_code() + - zend_gdb_present() + - _zend_handle_numeric_str(_ex)() + - zend_hash_exists_ind() + - zend_hash_str_exists_ind() + - zend_symtable_exists(_ind)() + - zend_symtable_str_exists() + - (*zend_encoding_lexer_compatibility_checker) + - zend_object_is_true() + - i_zend_is_true() + - zendi_smart_streq() + - zend_stack_is_empty() + - zend_ts_hash_exists() + - zend_ts_hash_index_exists() u. Instead of overwriting zend_error_cb extensions with debugging, monitoring use-cases catching Errors/Exceptions are strongly encouraged to use diff --git a/Zend/zend.c b/Zend/zend.c index 775a1cdb69..2e2ff03213 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -74,7 +74,7 @@ ZEND_API zend_class_entry *zend_standard_class_def = NULL; ZEND_API size_t (*zend_printf)(const char *format, ...); ZEND_API zend_write_func_t zend_write; ZEND_API FILE *(*zend_fopen)(const char *filename, zend_string **opened_path); -ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); +ZEND_API zend_result (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); ZEND_API void (*zend_ticks_function)(int ticks); ZEND_API void (*zend_interrupt_function)(zend_execute_data *execute_data); ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); @@ -82,9 +82,9 @@ void (*zend_printf_to_smart_string)(smart_string *buf, const char *format, va_li void (*zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap); ZEND_API char *(*zend_getenv)(const char *name, size_t name_len); ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t filename_len); -ZEND_API int (*zend_post_startup_cb)(void) = NULL; +ZEND_API zend_result (*zend_post_startup_cb)(void) = NULL; ZEND_API void (*zend_post_shutdown_cb)(void) = NULL; -ZEND_API int (*zend_preload_autoload)(zend_string *filename) = NULL; +ZEND_API zend_result (*zend_preload_autoload)(zend_string *filename) = NULL; /* This callback must be signal handler safe! */ void (*zend_on_timeout)(int seconds); @@ -365,7 +365,7 @@ static void print_flat_hash(HashTable *ht) /* {{{ */ } /* }}} */ -ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy) /* {{{ */ +ZEND_API bool zend_make_printable_zval(zval *expr, zval *expr_copy) /* {{{ */ { if (Z_TYPE_P(expr) == IS_STRING) { return 0; @@ -757,9 +757,8 @@ static void executor_globals_dtor(zend_executor_globals *executor_globals) /* {{ static void zend_new_thread_end_handler(THREAD_T thread_id) /* {{{ */ { - if (zend_copy_ini_directives() == SUCCESS) { - zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP); - } + zend_copy_ini_directives(); + zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP); } /* }}} */ #endif @@ -803,7 +802,7 @@ static zend_bool php_auto_globals_create_globals(zend_string *name) /* {{{ */ } /* }}} */ -int zend_startup(zend_utility_functions *utility_functions) /* {{{ */ +void zend_startup(zend_utility_functions *utility_functions) /* {{{ */ { #ifdef ZTS zend_compiler_globals *compiler_globals; @@ -969,8 +968,6 @@ int zend_startup(zend_utility_functions *utility_functions) /* {{{ */ tsrm_set_new_thread_end_handler(zend_new_thread_end_handler); tsrm_set_shutdown_handler(zend_interned_strings_dtor); #endif - - return SUCCESS; } /* }}} */ @@ -1021,7 +1018,7 @@ static void zend_resolve_property_types(void) /* {{{ */ /* Unlink the global (r/o) copies of the class, function and constant tables, * and use a fresh r/w copy for the startup thread */ -int zend_post_startup(void) /* {{{ */ +zend_result zend_post_startup(void) /* {{{ */ { #ifdef ZTS zend_encoding **script_encoding_list; @@ -1033,7 +1030,7 @@ int zend_post_startup(void) /* {{{ */ zend_resolve_property_types(); if (zend_post_startup_cb) { - int (*cb)(void) = zend_post_startup_cb; + zend_result (*cb)(void) = zend_post_startup_cb; zend_post_startup_cb = NULL; if (cb() != SUCCESS) { @@ -1665,13 +1662,13 @@ ZEND_API ZEND_COLD void zend_user_exception_handler(void) /* {{{ */ } } /* }}} */ -ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...) /* {{{ */ +ZEND_API zend_result zend_execute_scripts(int type, zval *retval, int file_count, ...) /* {{{ */ { va_list files; int i; zend_file_handle *file_handle; zend_op_array *op_array; - int ret = SUCCESS; + zend_result ret = SUCCESS; va_start(files, file_count); for (i = 0; i < file_count; i++) { diff --git a/Zend/zend.h b/Zend/zend.h index 5963ca7d9a..0a0506f915 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -195,7 +195,7 @@ typedef struct _zend_utility_functions { zval *(*get_configuration_directive)(zend_string *name); void (*ticks_function)(int ticks); void (*on_timeout)(int seconds); - int (*stream_open_function)(const char *filename, zend_file_handle *handle); + zend_result (*stream_open_function)(const char *filename, zend_file_handle *handle); void (*printf_to_smart_string_function)(smart_string *buf, const char *format, va_list ap); void (*printf_to_smart_str_function)(smart_str *buf, const char *format, va_list ap); char *(*getenv_function)(const char *name, size_t name_len); @@ -227,10 +227,10 @@ typedef size_t (*zend_write_func_t)(const char *str, size_t str_length); #define zend_first_try EG(bailout)=NULL; zend_try BEGIN_EXTERN_C() -int zend_startup(zend_utility_functions *utility_functions); +void zend_startup(zend_utility_functions *utility_functions); void zend_shutdown(void); void zend_register_standard_ini_entries(void); -int zend_post_startup(void); +zend_result zend_post_startup(void); void zend_set_utility_values(zend_utility_values *utility_values); ZEND_API ZEND_COLD ZEND_NORETURN void _zend_bailout(const char *filename, uint32_t lineno); @@ -246,7 +246,7 @@ ZEND_API size_t zend_spprintf_unchecked(char **message, size_t max_len, const ch ZEND_API zend_string *zend_strpprintf_unchecked(size_t max_len, const char *format, ...); ZEND_API const char *get_zend_version(void); -ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy); +ZEND_API bool zend_make_printable_zval(zval *expr, zval *expr_copy); ZEND_API size_t zend_print_zval(zval *expr, int indent); ZEND_API void zend_print_zval_r(zval *expr, int indent); ZEND_API zend_string *zend_print_zval_r_to_str(zval *expr, int indent); @@ -283,18 +283,18 @@ extern ZEND_API void (*zend_ticks_function)(int ticks); extern ZEND_API void (*zend_interrupt_function)(zend_execute_data *execute_data); extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); extern ZEND_API void (*zend_on_timeout)(int seconds); -extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); +extern ZEND_API zend_result (*zend_stream_open_function)(const char *filename, zend_file_handle *handle); extern void (*zend_printf_to_smart_string)(smart_string *buf, const char *format, va_list ap); extern void (*zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap); extern ZEND_API char *(*zend_getenv)(const char *name, size_t name_len); extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t filename_len); /* These two callbacks are especially for opcache */ -extern ZEND_API int (*zend_post_startup_cb)(void); +extern ZEND_API zend_result (*zend_post_startup_cb)(void); extern ZEND_API void (*zend_post_shutdown_cb)(void); /* Callback for loading of not preloaded part of the script */ -extern ZEND_API int (*zend_preload_autoload)(zend_string *filename); +extern ZEND_API zend_result (*zend_preload_autoload)(zend_string *filename); ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 9287913772..1e5dfe57b0 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -42,7 +42,7 @@ static zend_module_entry **module_post_deactivate_handlers; static zend_class_entry **class_cleanup_handlers; -ZEND_API int _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array) /* {{{ */ +ZEND_API zend_result _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array) /* {{{ */ { zval *param_ptr; uint32_t arg_count; @@ -64,7 +64,7 @@ ZEND_API int _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_ } /* }}} */ -ZEND_API int zend_copy_parameters_array(uint32_t param_count, zval *argument_array) /* {{{ */ +ZEND_API zend_result zend_copy_parameters_array(uint32_t param_count, zval *argument_array) /* {{{ */ { zval *param_ptr; uint32_t arg_count; @@ -369,7 +369,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_value_error(uint32_t arg_num } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, int check_null) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, bool check_null) /* {{{ */ { zend_class_entry *ce_base = *pce; @@ -398,7 +398,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pc } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) <= IS_STRING)) { *dest = zend_is_true(arg); @@ -409,7 +409,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest) } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { return 0; @@ -418,7 +418,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest) } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) { if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) { @@ -461,7 +461,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest) } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { return 0; @@ -470,7 +470,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest) } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { *dest = (double)Z_LVAL_P(arg); @@ -499,7 +499,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) / } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { /* SSTH Exception: IS_LONG may be accepted instead as IS_DOUBLE */ @@ -511,7 +511,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest) / } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { return 0; @@ -541,7 +541,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest) /* } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest) /* {{{ */ { if (EXPECTED(Z_TYPE_P(arg) < IS_STRING)) { convert_to_string(arg); @@ -563,7 +563,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { return 0; @@ -572,7 +572,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long) /* {{{ */ { if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { return 0; @@ -593,8 +593,8 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec { const char *spec_walk = *spec; char c = *spec_walk++; - int check_null = 0; - int separate = 0; + bool check_null = 0; + bool separate = 0; zval *real_arg = arg; /* scan through modifiers */ @@ -858,7 +858,7 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec } /* }}} */ -static int zend_parse_arg(uint32_t arg_num, zval *arg, va_list *va, const char **spec, int flags) /* {{{ */ +static zend_result zend_parse_arg(uint32_t arg_num, zval *arg, va_list *va, const char **spec, int flags) /* {{{ */ { const char *expected_type = NULL; char *error = NULL; @@ -886,10 +886,10 @@ static int zend_parse_arg(uint32_t arg_num, zval *arg, va_list *va, const char * } /* }}} */ -ZEND_API int zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...) +ZEND_API zend_result zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...) { va_list va; - int ret; + zend_result ret; va_start(va, spec); ret = zend_parse_arg(arg_num, arg, &va, &spec, flags); @@ -907,7 +907,7 @@ static ZEND_COLD void zend_parse_parameters_debug_error(const char *msg) { ZSTR_VAL(active_function->common.function_name), msg); } -static int zend_parse_va_args(uint32_t num_args, const char *type_spec, va_list *va, int flags) /* {{{ */ +static zend_result zend_parse_va_args(uint32_t num_args, const char *type_spec, va_list *va, int flags) /* {{{ */ { const char *spec_walk; char c; @@ -1049,10 +1049,10 @@ static int zend_parse_va_args(uint32_t num_args, const char *type_spec, va_list } /* }}} */ -ZEND_API int zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...) /* {{{ */ +ZEND_API zend_result zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...) /* {{{ */ { va_list va; - int retval; + zend_result retval; va_start(va, type_spec); retval = zend_parse_va_args(num_args, type_spec, &va, flags); @@ -1062,10 +1062,10 @@ ZEND_API int zend_parse_parameters_ex(int flags, uint32_t num_args, const char * } /* }}} */ -ZEND_API int zend_parse_parameters(uint32_t num_args, const char *type_spec, ...) /* {{{ */ +ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec, ...) /* {{{ */ { va_list va; - int retval; + zend_result retval; int flags = 0; va_start(va, type_spec); @@ -1076,10 +1076,10 @@ ZEND_API int zend_parse_parameters(uint32_t num_args, const char *type_spec, ... } /* }}} */ -ZEND_API int zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ +ZEND_API zend_result zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ { va_list va; - int retval; + zend_result retval; int flags = 0; const char *p = type_spec; zval **object; @@ -1116,10 +1116,10 @@ ZEND_API int zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, con } /* }}} */ -ZEND_API int zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ +ZEND_API zend_result zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */ { va_list va; - int retval; + zend_result retval; const char *p = type_spec; zval **object; zend_class_entry *ce; @@ -1172,7 +1172,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */ } /* }}} */ -ZEND_API int zend_update_class_constants(zend_class_entry *class_type) /* {{{ */ +ZEND_API zend_result zend_update_class_constants(zend_class_entry *class_type) /* {{{ */ { if (!(class_type->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) { zend_class_constant *c; @@ -1361,7 +1361,7 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties) * class and all props being public. If only a subset is given or the class * has protected members then you need to merge the properties separately by * calling zend_merge_properties(). */ -static zend_always_inline int _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ +static zend_always_inline zend_result _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ { if (UNEXPECTED(class_type->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) { if (class_type->ce_flags & ZEND_ACC_INTERFACE) { @@ -1400,13 +1400,13 @@ static zend_always_inline int _object_and_properties_init(zval *arg, zend_class_ } /* }}} */ -ZEND_API int object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ +ZEND_API zend_result object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ { return _object_and_properties_init(arg, class_type, properties); } /* }}} */ -ZEND_API int object_init_ex(zval *arg, zend_class_entry *class_type) /* {{{ */ +ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *class_type) /* {{{ */ { return _object_and_properties_init(arg, class_type, NULL); } @@ -1436,7 +1436,7 @@ ZEND_API void add_assoc_null_ex(zval *arg, const char *key, size_t key_len) /* { } /* }}} */ -ZEND_API void add_assoc_bool_ex(zval *arg, const char *key, size_t key_len, int b) /* {{{ */ +ZEND_API void add_assoc_bool_ex(zval *arg, const char *key, size_t key_len, bool b) /* {{{ */ { zval tmp; @@ -1514,7 +1514,7 @@ ZEND_API void add_index_null(zval *arg, zend_ulong index) /* {{{ */ } /* }}} */ -ZEND_API void add_index_bool(zval *arg, zend_ulong index, int b) /* {{{ */ +ZEND_API void add_index_bool(zval *arg, zend_ulong index, bool b) /* {{{ */ { zval tmp; @@ -1568,7 +1568,7 @@ ZEND_API void add_index_stringl(zval *arg, zend_ulong index, const char *str, si } /* }}} */ -ZEND_API int add_next_index_long(zval *arg, zend_long n) /* {{{ */ +ZEND_API zend_result add_next_index_long(zval *arg, zend_long n) /* {{{ */ { zval tmp; @@ -1577,7 +1577,7 @@ ZEND_API int add_next_index_long(zval *arg, zend_long n) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_null(zval *arg) /* {{{ */ +ZEND_API zend_result add_next_index_null(zval *arg) /* {{{ */ { zval tmp; @@ -1586,7 +1586,7 @@ ZEND_API int add_next_index_null(zval *arg) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_bool(zval *arg, zend_bool b) /* {{{ */ +ZEND_API zend_result add_next_index_bool(zval *arg, zend_bool b) /* {{{ */ { zval tmp; @@ -1595,7 +1595,7 @@ ZEND_API int add_next_index_bool(zval *arg, zend_bool b) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_resource(zval *arg, zend_resource *r) /* {{{ */ +ZEND_API zend_result add_next_index_resource(zval *arg, zend_resource *r) /* {{{ */ { zval tmp; @@ -1604,7 +1604,7 @@ ZEND_API int add_next_index_resource(zval *arg, zend_resource *r) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_double(zval *arg, double d) /* {{{ */ +ZEND_API zend_result add_next_index_double(zval *arg, double d) /* {{{ */ { zval tmp; @@ -1613,7 +1613,7 @@ ZEND_API int add_next_index_double(zval *arg, double d) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_str(zval *arg, zend_string *str) /* {{{ */ +ZEND_API zend_result add_next_index_str(zval *arg, zend_string *str) /* {{{ */ { zval tmp; @@ -1622,7 +1622,7 @@ ZEND_API int add_next_index_str(zval *arg, zend_string *str) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_string(zval *arg, const char *str) /* {{{ */ +ZEND_API zend_result add_next_index_string(zval *arg, const char *str) /* {{{ */ { zval tmp; @@ -1631,7 +1631,7 @@ ZEND_API int add_next_index_string(zval *arg, const char *str) /* {{{ */ } /* }}} */ -ZEND_API int add_next_index_stringl(zval *arg, const char *str, size_t length) /* {{{ */ +ZEND_API zend_result add_next_index_stringl(zval *arg, const char *str, size_t length) /* {{{ */ { zval tmp; @@ -1640,7 +1640,7 @@ ZEND_API int add_next_index_stringl(zval *arg, const char *str, size_t length) / } /* }}} */ -ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ +ZEND_API zend_result array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ { zval *result; @@ -1767,7 +1767,7 @@ ZEND_API void add_property_zval_ex(zval *arg, const char *key, size_t key_len, z } /* }}} */ -ZEND_API int zend_startup_module_ex(zend_module_entry *module) /* {{{ */ +ZEND_API zend_result zend_startup_module_ex(zend_module_entry *module) /* {{{ */ { size_t name_len; zend_string *lcname; @@ -2254,7 +2254,7 @@ ZEND_API void zend_add_magic_method(zend_class_entry *ce, zend_function *fptr, z } /* registers all functions in *library_functions in the function hash */ -ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type) /* {{{ */ +ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type) /* {{{ */ { const zend_function_entry *ptr = functions; zend_function function, *reg_function; @@ -2477,7 +2477,7 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in } /* }}} */ -ZEND_API int zend_startup_module(zend_module_entry *module) /* {{{ */ +ZEND_API zend_result zend_startup_module(zend_module_entry *module) /* {{{ */ { if ((module = zend_register_internal_module(module)) != NULL && zend_startup_module_ex(module) == SUCCESS) { return SUCCESS; @@ -2486,7 +2486,7 @@ ZEND_API int zend_startup_module(zend_module_entry *module) /* {{{ */ } /* }}} */ -ZEND_API int zend_get_module_started(const char *module_name) /* {{{ */ +ZEND_API zend_result zend_get_module_started(const char *module_name) /* {{{ */ { zend_module_entry *module; @@ -2730,7 +2730,7 @@ ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *or } /* }}} */ -ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, int persistent) /* {{{ */ +ZEND_API zend_result zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, bool persistent) /* {{{ */ { zend_string *lcname; zval zv, *ret; @@ -2765,7 +2765,8 @@ ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zen } /* }}} */ -ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...) /* {{{ */ +// TODO num_symbol_tables as unsigned int? +ZEND_API zend_result zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...) /* {{{ */ { HashTable *symbol_table; va_list symbol_table_list; @@ -2789,7 +2790,7 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, size_t name_le /* Disabled functions support */ -ZEND_API int zend_disable_function(const char *function_name, size_t function_name_length) /* {{{ */ +ZEND_API zend_result zend_disable_function(const char *function_name, size_t function_name_length) /* {{{ */ { return zend_hash_str_del(CG(function_table), function_name, function_name_length); } @@ -2826,7 +2827,7 @@ static const zend_function_entry disabled_class_new[] = { ZEND_FE_END }; -ZEND_API int zend_disable_class(const char *class_name, size_t class_name_length) /* {{{ */ +ZEND_API zend_result zend_disable_class(const char *class_name, size_t class_name_length) /* {{{ */ { zend_class_entry *disabled_class; zend_string *key; @@ -2859,9 +2860,9 @@ static zend_always_inline zend_class_entry *get_scope(zend_execute_data *frame) return frame && frame->func ? frame->func->common.scope : NULL; } -static int zend_is_callable_check_class(zend_string *name, zend_class_entry *scope, zend_execute_data *frame, zend_fcall_info_cache *fcc, int *strict_class, char **error) /* {{{ */ +static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *scope, zend_execute_data *frame, zend_fcall_info_cache *fcc, bool *strict_class, char **error) /* {{{ */ { - int ret = 0; + bool ret = 0; zend_class_entry *ce; size_t name_len = ZSTR_LEN(name); zend_string *lcname; @@ -2948,10 +2949,10 @@ ZEND_API void zend_release_fcall_info_cache(zend_fcall_info_cache *fcc) { fcc->function_handler = NULL; } -static zend_always_inline int zend_is_callable_check_func(int check_flags, zval *callable, zend_execute_data *frame, zend_fcall_info_cache *fcc, int strict_class, char **error) /* {{{ */ +static zend_always_inline bool zend_is_callable_check_func(int check_flags, zval *callable, zend_execute_data *frame, zend_fcall_info_cache *fcc, bool strict_class, char **error) /* {{{ */ { zend_class_entry *ce_org = fcc->calling_scope; - int retval = 0; + bool retval = 0; zend_string *mname, *cname; zend_string *lmname; const char *colon; @@ -3236,7 +3237,7 @@ static zend_always_inline zend_bool zend_is_callable_impl( { zend_bool ret; zend_fcall_info_cache fcc_local; - int strict_class = 0; + bool strict_class = 0; if (fcc == NULL) { fcc = &fcc_local; @@ -3390,7 +3391,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam } /* }}} */ -ZEND_API int zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error) /* {{{ */ +ZEND_API zend_result zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error) /* {{{ */ { if (!zend_is_callable_ex(callable, NULL, check_flags, callable_name, fcc, error)) { return FAILURE; @@ -3408,7 +3409,7 @@ ZEND_API int zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fca } /* }}} */ -ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem) /* {{{ */ +ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, bool free_mem) /* {{{ */ { if (fci->params) { zval *p = fci->params; @@ -3444,7 +3445,7 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, uint32_t param_ } /* }}} */ -ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args) /* {{{ */ +ZEND_API zend_result zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args) /* {{{ */ { zval *arg, *params; uint32_t n = 1; @@ -3477,7 +3478,7 @@ ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, } /* }}} */ -ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args) /* {{{ */ +ZEND_API zend_result zend_fcall_info_args(zend_fcall_info *fci, zval *args) /* {{{ */ { return zend_fcall_info_args_ex(fci, NULL, args); } @@ -3525,11 +3526,11 @@ ZEND_API void zend_fcall_info_argn(zend_fcall_info *fci, uint32_t argc, ...) /* } /* }}} */ -ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval_ptr, zval *args) /* {{{ */ +ZEND_API zend_result zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval_ptr, zval *args) /* {{{ */ { zval retval, *org_params = NULL; uint32_t org_count = 0; - int result; + zend_result result; fci->retval = retval_ptr ? retval_ptr : &retval; if (args) { @@ -3680,7 +3681,7 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_ex(zend_reference *ref, zval *val, zend_bool strict) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_ex(zend_reference *ref, zval *val, zend_bool strict) /* {{{ */ { if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, val, strict))) { zval_ptr_dtor(val); @@ -3693,13 +3694,13 @@ ZEND_API int zend_try_assign_typed_ref_ex(zend_reference *ref, zval *val, zend_b } /* }}} */ -ZEND_API int zend_try_assign_typed_ref(zend_reference *ref, zval *val) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref(zend_reference *ref, zval *val) /* {{{ */ { return zend_try_assign_typed_ref_ex(ref, val, ZEND_ARG_USES_STRICT_TYPES()); } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_null(zend_reference *ref) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_null(zend_reference *ref) /* {{{ */ { zval tmp; @@ -3708,7 +3709,7 @@ ZEND_API int zend_try_assign_typed_ref_null(zend_reference *ref) /* {{{ */ } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val) /* {{{ */ { zval tmp; @@ -3717,7 +3718,7 @@ ZEND_API int zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val) } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval) /* {{{ */ { zval tmp; @@ -3726,7 +3727,7 @@ ZEND_API int zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval) } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_double(zend_reference *ref, double dval) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_double(zend_reference *ref, double dval) /* {{{ */ { zval tmp; @@ -3735,7 +3736,7 @@ ZEND_API int zend_try_assign_typed_ref_double(zend_reference *ref, double dval) } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_empty_string(zend_reference *ref) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_empty_string(zend_reference *ref) /* {{{ */ { zval tmp; @@ -3744,7 +3745,7 @@ ZEND_API int zend_try_assign_typed_ref_empty_string(zend_reference *ref) /* {{{ } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str) /* {{{ */ { zval tmp; @@ -3753,7 +3754,7 @@ ZEND_API int zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_string(zend_reference *ref, const char *string) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_string(zend_reference *ref, const char *string) /* {{{ */ { zval tmp; @@ -3762,7 +3763,7 @@ ZEND_API int zend_try_assign_typed_ref_string(zend_reference *ref, const char *s } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len) /* {{{ */ { zval tmp; @@ -3771,7 +3772,7 @@ ZEND_API int zend_try_assign_typed_ref_stringl(zend_reference *ref, const char * } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr) /* {{{ */ { zval tmp; @@ -3780,7 +3781,7 @@ ZEND_API int zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr) } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res) /* {{{ */ { zval tmp; @@ -3789,7 +3790,7 @@ ZEND_API int zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *r } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv) /* {{{ */ { zval tmp; @@ -3798,7 +3799,7 @@ ZEND_API int zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv) /* {{ } /* }}} */ -ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict) /* {{{ */ +ZEND_API zend_result zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict) /* {{{ */ { zval tmp; @@ -4089,7 +4090,7 @@ ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zend_object } /* }}} */ -ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value) /* {{{ */ +ZEND_API zend_result zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value) /* {{{ */ { zval *property, tmp; zend_property_info *prop_info; @@ -4125,16 +4126,16 @@ ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string } /* }}} */ -ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value) /* {{{ */ +ZEND_API zend_result zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value) /* {{{ */ { zend_string *key = zend_string_init(name, name_length, 0); - int retval = zend_update_static_property_ex(scope, key, value); + bool retval = zend_update_static_property_ex(scope, key, value); zend_string_efree(key); return retval; } /* }}} */ -ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length) /* {{{ */ +ZEND_API zend_result zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length) /* {{{ */ { zval tmp; @@ -4143,7 +4144,7 @@ ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const cha } /* }}} */ -ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ +ZEND_API zend_result zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ { zval tmp; @@ -4152,7 +4153,7 @@ ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const cha } /* }}} */ -ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ +ZEND_API zend_result zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value) /* {{{ */ { zval tmp; @@ -4161,7 +4162,7 @@ ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const cha } /* }}} */ -ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value) /* {{{ */ +ZEND_API zend_result zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value) /* {{{ */ { zval tmp; @@ -4170,7 +4171,7 @@ ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const c } /* }}} */ -ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value) /* {{{ */ +ZEND_API zend_result zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value) /* {{{ */ { zval tmp; @@ -4180,7 +4181,7 @@ ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const c } /* }}} */ -ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_len) /* {{{ */ +ZEND_API zend_result zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_len) /* {{{ */ { zval tmp; @@ -4314,7 +4315,7 @@ ZEND_API zend_bool zend_is_countable(zval *countable) /* {{{ */ } /* }}} */ -static int get_default_via_ast(zval *default_value_zval, const char *default_value) { +static zend_result get_default_via_ast(zval *default_value_zval, const char *default_value) { zend_ast *ast; zend_arena *ast_arena; @@ -4362,7 +4363,7 @@ static zend_string *try_parse_string(const char *str, size_t len, char quote) { return zend_string_init(str, len, 0); } -ZEND_API int zend_get_default_from_internal_arg_info( +ZEND_API zend_result zend_get_default_from_internal_arg_info( zval *default_value_zval, zend_internal_arg_info *arg_info) { const char *default_value = arg_info->default_value; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index adf84affd2..6d588cc900 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -182,11 +182,11 @@ typedef struct _zend_fcall_info_cache { #define ZEND_MODULE_GLOBALS_DTOR_N(module) zm_globals_dtor_##module /* Declaration macros */ -#define ZEND_MODULE_STARTUP_D(module) int ZEND_MODULE_STARTUP_N(module)(INIT_FUNC_ARGS) -#define ZEND_MODULE_SHUTDOWN_D(module) int ZEND_MODULE_SHUTDOWN_N(module)(SHUTDOWN_FUNC_ARGS) -#define ZEND_MODULE_ACTIVATE_D(module) int ZEND_MODULE_ACTIVATE_N(module)(INIT_FUNC_ARGS) -#define ZEND_MODULE_DEACTIVATE_D(module) int ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS) -#define ZEND_MODULE_POST_ZEND_DEACTIVATE_D(module) int ZEND_MODULE_POST_ZEND_DEACTIVATE_N(module)(void) +#define ZEND_MODULE_STARTUP_D(module) zend_result ZEND_MODULE_STARTUP_N(module)(INIT_FUNC_ARGS) +#define ZEND_MODULE_SHUTDOWN_D(module) zend_result ZEND_MODULE_SHUTDOWN_N(module)(SHUTDOWN_FUNC_ARGS) +#define ZEND_MODULE_ACTIVATE_D(module) zend_result ZEND_MODULE_ACTIVATE_N(module)(INIT_FUNC_ARGS) +#define ZEND_MODULE_DEACTIVATE_D(module) zend_result ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS) +#define ZEND_MODULE_POST_ZEND_DEACTIVATE_D(module) zend_result ZEND_MODULE_POST_ZEND_DEACTIVATE_N(module)(void) #define ZEND_MODULE_INFO_D(module) ZEND_COLD void ZEND_MODULE_INFO_N(module)(ZEND_MODULE_INFO_FUNC_ARGS) #define ZEND_MODULE_GLOBALS_CTOR_D(module) void ZEND_MODULE_GLOBALS_CTOR_N(module)(zend_##module##_globals *module##_globals) #define ZEND_MODULE_GLOBALS_DTOR_D(module) void ZEND_MODULE_GLOBALS_DTOR_N(module)(zend_##module##_globals *module##_globals) @@ -283,10 +283,10 @@ typedef struct _zend_fcall_info_cache { ZEND_API int zend_next_free_module(void); BEGIN_EXTERN_C() -ZEND_API int _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array); +ZEND_API zend_result _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array); /* internal function to efficiently copy parameters when executing __call() */ -ZEND_API int zend_copy_parameters_array(uint32_t param_count, zval *argument_array); +ZEND_API zend_result zend_copy_parameters_array(uint32_t param_count, zval *argument_array); #define zend_get_parameters_array(ht, param_count, argument_array) \ _zend_get_parameters_array_ex(param_count, argument_array) @@ -301,27 +301,27 @@ ZEND_API int zend_copy_parameters_array(uint32_t param_count, zval *argument_arr #define ZEND_PARSE_PARAMS_THROW 0 /* No longer used, zpp always uses exceptions */ #define ZEND_PARSE_PARAMS_QUIET (1<<1) -ZEND_API int zend_parse_parameters(uint32_t num_args, const char *type_spec, ...); -ZEND_API int zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...); +ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec, ...); +ZEND_API zend_result zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec, ...); /* NOTE: This must have at least one value in __VA_ARGS__ for the expression to be valid */ #define zend_parse_parameters_throw(num_args, ...) \ zend_parse_parameters(num_args, __VA_ARGS__) ZEND_API const char *zend_zval_type_name(const zval *arg); ZEND_API zend_string *zend_zval_get_legacy_type(const zval *arg); -ZEND_API int zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...); -ZEND_API int zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...); +ZEND_API zend_result zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...); +ZEND_API zend_result zend_parse_method_parameters_ex(int flags, uint32_t num_args, zval *this_ptr, const char *type_spec, ...); -ZEND_API int zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...); +ZEND_API zend_result zend_parse_parameter(int flags, uint32_t arg_num, zval *arg, const char *spec, ...); /* End of parameter parsing API -- andrei */ -ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type); +ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type); ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table); -ZEND_API int zend_startup_module(zend_module_entry *module_entry); +ZEND_API zend_result zend_startup_module(zend_module_entry *module_entry); ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry); ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module); -ZEND_API int zend_startup_module_ex(zend_module_entry *module); +ZEND_API zend_result zend_startup_module_ex(zend_module_entry *module); ZEND_API void zend_startup_modules(void); ZEND_API void zend_collect_module_handlers(void); ZEND_API void zend_destroy_modules(void); @@ -334,15 +334,15 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry); ZEND_API void zend_class_implements(zend_class_entry *class_entry, int num_interfaces, ...); -ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, int persistent); +ZEND_API zend_result zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, bool persistent); #define zend_register_class_alias(name, ce) \ zend_register_class_alias_ex(name, sizeof(name)-1, ce, 1) #define zend_register_ns_class_alias(ns, name, ce) \ zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce, 1) -ZEND_API int zend_disable_function(const char *function_name, size_t function_name_length); -ZEND_API int zend_disable_class(const char *class_name, size_t class_name_length); +ZEND_API zend_result zend_disable_function(const char *function_name, size_t function_name_length); +ZEND_API zend_result zend_disable_class(const char *class_name, size_t class_name_length); ZEND_API ZEND_COLD void zend_wrong_param_count(void); @@ -378,7 +378,7 @@ ZEND_API void zend_declare_class_constant_double(zend_class_entry *ce, const cha ZEND_API void zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length); ZEND_API void zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value); -ZEND_API int zend_update_class_constants(zend_class_entry *class_type); +ZEND_API zend_result zend_update_class_constants(zend_class_entry *class_type); ZEND_API void zend_update_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, zval *value); ZEND_API void zend_update_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, zval *value); @@ -391,14 +391,14 @@ ZEND_API void zend_update_property_string(zend_class_entry *scope, zend_object * ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, const char *value, size_t value_length); ZEND_API void zend_unset_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length); -ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value); -ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value); -ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length); -ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); -ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); -ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value); -ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value); -ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_length); +ZEND_API zend_result zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value); +ZEND_API zend_result zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value); +ZEND_API zend_result zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length); +ZEND_API zend_result zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); +ZEND_API zend_result zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value); +ZEND_API zend_result zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value); +ZEND_API zend_result zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value); +ZEND_API zend_result zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_length); ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, zend_bool silent, zval *rv); ZEND_API zval *zend_read_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, zend_bool silent, zval *rv); @@ -426,8 +426,8 @@ ZEND_API const char *zend_get_type_by_const(int type); #define array_init(arg) ZVAL_ARR((arg), zend_new_array(0)) #define array_init_size(arg, size) ZVAL_ARR((arg), zend_new_array(size)) ZEND_API void object_init(zval *arg); -ZEND_API int object_init_ex(zval *arg, zend_class_entry *ce); -ZEND_API int object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties); +ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *ce); +ZEND_API zend_result object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties); ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type); ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properties); ZEND_API void object_properties_load(zend_object *object, HashTable *properties); @@ -436,7 +436,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties); ZEND_API void add_assoc_long_ex(zval *arg, const char *key, size_t key_len, zend_long n); ZEND_API void add_assoc_null_ex(zval *arg, const char *key, size_t key_len); -ZEND_API void add_assoc_bool_ex(zval *arg, const char *key, size_t key_len, int b); +ZEND_API void add_assoc_bool_ex(zval *arg, const char *key, size_t key_len, bool b); ZEND_API void add_assoc_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r); ZEND_API void add_assoc_double_ex(zval *arg, const char *key, size_t key_len, double d); ZEND_API void add_assoc_str_ex(zval *arg, const char *key, size_t key_len, zend_string *str); @@ -456,33 +456,33 @@ ZEND_API void add_assoc_zval_ex(zval *arg, const char *key, size_t key_len, zval ZEND_API void add_index_long(zval *arg, zend_ulong index, zend_long n); ZEND_API void add_index_null(zval *arg, zend_ulong index); -ZEND_API void add_index_bool(zval *arg, zend_ulong index, int b); +ZEND_API void add_index_bool(zval *arg, zend_ulong index, bool b); ZEND_API void add_index_resource(zval *arg, zend_ulong index, zend_resource *r); ZEND_API void add_index_double(zval *arg, zend_ulong index, double d); ZEND_API void add_index_str(zval *arg, zend_ulong index, zend_string *str); ZEND_API void add_index_string(zval *arg, zend_ulong index, const char *str); ZEND_API void add_index_stringl(zval *arg, zend_ulong index, const char *str, size_t length); -static zend_always_inline int add_index_zval(zval *arg, zend_ulong index, zval *value) +static zend_always_inline zend_result add_index_zval(zval *arg, zend_ulong index, zval *value) { return zend_hash_index_update(Z_ARRVAL_P(arg), index, value) ? SUCCESS : FAILURE; } -ZEND_API int add_next_index_long(zval *arg, zend_long n); -ZEND_API int add_next_index_null(zval *arg); -ZEND_API int add_next_index_bool(zval *arg, zend_bool b); -ZEND_API int add_next_index_resource(zval *arg, zend_resource *r); -ZEND_API int add_next_index_double(zval *arg, double d); -ZEND_API int add_next_index_str(zval *arg, zend_string *str); -ZEND_API int add_next_index_string(zval *arg, const char *str); -ZEND_API int add_next_index_stringl(zval *arg, const char *str, size_t length); +ZEND_API zend_result add_next_index_long(zval *arg, zend_long n); +ZEND_API zend_result add_next_index_null(zval *arg); +ZEND_API zend_result add_next_index_bool(zval *arg, zend_bool b); +ZEND_API zend_result add_next_index_resource(zval *arg, zend_resource *r); +ZEND_API zend_result add_next_index_double(zval *arg, double d); +ZEND_API zend_result add_next_index_str(zval *arg, zend_string *str); +ZEND_API zend_result add_next_index_string(zval *arg, const char *str); +ZEND_API zend_result add_next_index_stringl(zval *arg, const char *str, size_t length); -static zend_always_inline int add_next_index_zval(zval *arg, zval *value) +static zend_always_inline zend_result add_next_index_zval(zval *arg, zval *value) { return zend_hash_next_index_insert(Z_ARRVAL_P(arg), value) ? SUCCESS : FAILURE; } -ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value); +ZEND_API zend_result array_set_zval_key(HashTable *ht, zval *key, zval *value); ZEND_API void add_property_long_ex(zval *arg, const char *key, size_t key_len, zend_long l); ZEND_API void add_property_null_ex(zval *arg, const char *key, size_t key_len); @@ -505,7 +505,7 @@ ZEND_API void add_property_zval_ex(zval *arg, const char *key, size_t key_len, z #define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value) -ZEND_API int _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params); +ZEND_API zend_result _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params); #define call_user_function(function_table, object, function_name, retval_ptr, param_count, params) \ _call_user_function_impl(object, function_name, retval_ptr, param_count, params, NULL) @@ -524,12 +524,12 @@ ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache; * fci->params = NULL; * The callable_name argument may be NULL. */ -ZEND_API int zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error); +ZEND_API zend_result zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error); /** Clear arguments connected with zend_fcall_info *fci * If free_mem is not zero then the params array gets free'd as well */ -ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem); +ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, bool free_mem); /** Save current arguments from zend_fcall_info *fci * params array will be set to NULL @@ -543,8 +543,8 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, uint32_t param_ /** Set or clear the arguments in the zend_call_info struct taking care of * refcount. If args is NULL and arguments are set then those are cleared. */ -ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args); -ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args); +ZEND_API zend_result zend_fcall_info_args(zend_fcall_info *fci, zval *args); +ZEND_API zend_result zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args); /** Set arguments in the zend_fcall_info struct taking care of refcount. * If argc is 0 the arguments which are set will be cleared, else pass @@ -567,9 +567,9 @@ ZEND_API void zend_fcall_info_argn(zend_fcall_info *fci, uint32_t argc, ...); /** Call a function using information created by zend_fcall_info_init()/args(). * If args is given then those replace the argument info in fci is temporarily. */ -ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval, zval *args); +ZEND_API zend_result zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval, zval *args); -ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache); +ZEND_API zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache); /* Call the provided zend_function with the given params. * If retval_ptr is NULL, the return value is discarded. @@ -602,17 +602,17 @@ static zend_always_inline void zend_call_known_instance_method_with_1_params( ZEND_API void zend_call_known_instance_method_with_2_params( zend_function *fn, zend_object *object, zval *retval_ptr, zval *param1, zval *param2); -ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...); +ZEND_API zend_result zend_set_hash_symbol(zval *symbol, const char *name, size_t name_length, zend_bool is_ref, int num_symbol_tables, ...); -ZEND_API int zend_delete_global_variable(zend_string *name); +ZEND_API zend_result zend_delete_global_variable(zend_string *name); ZEND_API zend_array *zend_rebuild_symbol_table(void); ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data); ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data); -ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force); -ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force); +ZEND_API zend_result zend_set_local_var(zend_string *name, zval *value, bool force); +ZEND_API zend_result zend_set_local_var_str(const char *name, size_t len, zval *value, bool force); -static zend_always_inline int zend_forbid_dynamic_call(const char *func_name) +static zend_always_inline zend_result zend_forbid_dynamic_call(const char *func_name) { zend_execute_data *ex = EG(current_execute_data); ZEND_ASSERT(ex != NULL && ex->func != NULL); @@ -631,7 +631,7 @@ ZEND_API zend_bool zend_is_iterable(zval *iterable); ZEND_API zend_bool zend_is_countable(zval *countable); -ZEND_API int zend_get_default_from_internal_arg_info( +ZEND_API zend_result zend_get_default_from_internal_arg_info( zval *default_value_zval, zend_internal_arg_info *arg_info); END_EXTERN_C() @@ -779,21 +779,21 @@ END_EXTERN_C() /* May modify arg in-place. Will free arg in failure case (and take ownership in success case). * Prefer using the ZEND_TRY_ASSIGN_* macros over these APIs. */ -ZEND_API int zend_try_assign_typed_ref_ex(zend_reference *ref, zval *zv, zend_bool strict); -ZEND_API int zend_try_assign_typed_ref(zend_reference *ref, zval *zv); - -ZEND_API int zend_try_assign_typed_ref_null(zend_reference *ref); -ZEND_API int zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val); -ZEND_API int zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval); -ZEND_API int zend_try_assign_typed_ref_double(zend_reference *ref, double dval); -ZEND_API int zend_try_assign_typed_ref_empty_string(zend_reference *ref); -ZEND_API int zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str); -ZEND_API int zend_try_assign_typed_ref_string(zend_reference *ref, const char *string); -ZEND_API int zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len); -ZEND_API int zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr); -ZEND_API int zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res); -ZEND_API int zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv); -ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict); +ZEND_API zend_result zend_try_assign_typed_ref_ex(zend_reference *ref, zval *zv, zend_bool strict); +ZEND_API zend_result zend_try_assign_typed_ref(zend_reference *ref, zval *zv); + +ZEND_API zend_result zend_try_assign_typed_ref_null(zend_reference *ref); +ZEND_API zend_result zend_try_assign_typed_ref_bool(zend_reference *ref, zend_bool val); +ZEND_API zend_result zend_try_assign_typed_ref_long(zend_reference *ref, zend_long lval); +ZEND_API zend_result zend_try_assign_typed_ref_double(zend_reference *ref, double dval); +ZEND_API zend_result zend_try_assign_typed_ref_empty_string(zend_reference *ref); +ZEND_API zend_result zend_try_assign_typed_ref_str(zend_reference *ref, zend_string *str); +ZEND_API zend_result zend_try_assign_typed_ref_string(zend_reference *ref, const char *string); +ZEND_API zend_result zend_try_assign_typed_ref_stringl(zend_reference *ref, const char *string, size_t len); +ZEND_API zend_result zend_try_assign_typed_ref_arr(zend_reference *ref, zend_array *arr); +ZEND_API zend_result zend_try_assign_typed_ref_res(zend_reference *ref, zend_resource *res); +ZEND_API zend_result zend_try_assign_typed_ref_zval(zend_reference *ref, zval *zv); +ZEND_API zend_result zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, zend_bool strict); #define _ZEND_TRY_ASSIGN_NULL(zv, is_ref) do { \ zval *_zv = zv; \ @@ -1176,7 +1176,7 @@ static zend_always_inline zval *zend_try_array_init_size(zval *zv, uint32_t size if (EXPECTED(Z_ISREF_P(zv))) { zend_reference *ref = Z_REF_P(zv); if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) { - if (zend_try_assign_typed_ref_arr(ref, arr) != SUCCESS) { + if (zend_try_assign_typed_ref_arr(ref, arr) == FAILURE) { return NULL; } return &ref->val; @@ -1771,19 +1771,19 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_value_error(uint32_t arg_num /* Inlined implementations shared by new and old parameter parsing APIs */ -ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, int check_null); -ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest); -ZEND_API int ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long); - -static zend_always_inline int zend_parse_arg_bool(zval *arg, zend_bool *dest, zend_bool *is_null, int check_null) +ZEND_API bool ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, bool check_null); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest); +ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long); + +static zend_always_inline bool zend_parse_arg_bool(zval *arg, zend_bool *dest, zend_bool *is_null, bool check_null) { if (check_null) { *is_null = 0; @@ -1801,7 +1801,7 @@ static zend_always_inline int zend_parse_arg_bool(zval *arg, zend_bool *dest, ze return 1; } -static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, zend_bool *is_null, int check_null) +static zend_always_inline bool zend_parse_arg_long(zval *arg, zend_long *dest, zend_bool *is_null, bool check_null) { if (check_null) { *is_null = 0; @@ -1817,7 +1817,7 @@ static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, ze return 1; } -static zend_always_inline int zend_parse_arg_double(zval *arg, double *dest, zend_bool *is_null, int check_null) +static zend_always_inline bool zend_parse_arg_double(zval *arg, double *dest, zend_bool *is_null, bool check_null) { if (check_null) { *is_null = 0; @@ -1833,7 +1833,7 @@ static zend_always_inline int zend_parse_arg_double(zval *arg, double *dest, zen return 1; } -static zend_always_inline int zend_parse_arg_number(zval *arg, zval **dest, int check_null) +static zend_always_inline bool zend_parse_arg_number(zval *arg, zval **dest, bool check_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_LONG || Z_TYPE_P(arg) == IS_DOUBLE)) { *dest = arg; @@ -1845,7 +1845,7 @@ static zend_always_inline int zend_parse_arg_number(zval *arg, zval **dest, int return 1; } -static zend_always_inline int zend_parse_arg_str(zval *arg, zend_string **dest, int check_null) +static zend_always_inline bool zend_parse_arg_str(zval *arg, zend_string **dest, bool check_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { *dest = Z_STR_P(arg); @@ -1857,7 +1857,7 @@ static zend_always_inline int zend_parse_arg_str(zval *arg, zend_string **dest, return 1; } -static zend_always_inline int zend_parse_arg_string(zval *arg, char **dest, size_t *dest_len, int check_null) +static zend_always_inline bool zend_parse_arg_string(zval *arg, char **dest, size_t *dest_len, bool check_null) { zend_string *str; @@ -1874,7 +1874,7 @@ static zend_always_inline int zend_parse_arg_string(zval *arg, char **dest, size return 1; } -static zend_always_inline int zend_parse_arg_path_str(zval *arg, zend_string **dest, int check_null) +static zend_always_inline bool zend_parse_arg_path_str(zval *arg, zend_string **dest, bool check_null) { if (!zend_parse_arg_str(arg, dest, check_null) || (*dest && UNEXPECTED(CHECK_NULL_PATH(ZSTR_VAL(*dest), ZSTR_LEN(*dest))))) { @@ -1883,7 +1883,7 @@ static zend_always_inline int zend_parse_arg_path_str(zval *arg, zend_string **d return 1; } -static zend_always_inline int zend_parse_arg_path(zval *arg, char **dest, size_t *dest_len, int check_null) +static zend_always_inline bool zend_parse_arg_path(zval *arg, char **dest, size_t *dest_len, bool check_null) { zend_string *str; @@ -1900,7 +1900,7 @@ static zend_always_inline int zend_parse_arg_path(zval *arg, char **dest, size_t return 1; } -static zend_always_inline int zend_parse_arg_array(zval *arg, zval **dest, int check_null, int or_object) +static zend_always_inline bool zend_parse_arg_array(zval *arg, zval **dest, bool check_null, bool or_object) { if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY) || (or_object && EXPECTED(Z_TYPE_P(arg) == IS_OBJECT))) { @@ -1913,7 +1913,7 @@ static zend_always_inline int zend_parse_arg_array(zval *arg, zval **dest, int c return 1; } -static zend_always_inline int zend_parse_arg_array_ht(zval *arg, HashTable **dest, int check_null, int or_object, int separate) +static zend_always_inline bool zend_parse_arg_array_ht(zval *arg, HashTable **dest, bool check_null, bool or_object, bool separate) { if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY)) { *dest = Z_ARRVAL_P(arg); @@ -1936,7 +1936,7 @@ static zend_always_inline int zend_parse_arg_array_ht(zval *arg, HashTable **des return 1; } -static zend_always_inline int zend_parse_arg_object(zval *arg, zval **dest, zend_class_entry *ce, int check_null) +static zend_always_inline bool zend_parse_arg_object(zval *arg, zval **dest, zend_class_entry *ce, bool check_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT) && (!ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), ce) != 0))) { @@ -1949,7 +1949,7 @@ static zend_always_inline int zend_parse_arg_object(zval *arg, zval **dest, zend return 1; } -static zend_always_inline int zend_parse_arg_resource(zval *arg, zval **dest, int check_null) +static zend_always_inline bool zend_parse_arg_resource(zval *arg, zval **dest, bool check_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_RESOURCE)) { *dest = arg; @@ -1961,7 +1961,7 @@ static zend_always_inline int zend_parse_arg_resource(zval *arg, zval **dest, in return 1; } -static zend_always_inline int zend_parse_arg_func(zval *arg, zend_fcall_info *dest_fci, zend_fcall_info_cache *dest_fcc, int check_null, char **error) +static zend_always_inline bool zend_parse_arg_func(zval *arg, zend_fcall_info *dest_fci, zend_fcall_info_cache *dest_fcc, bool check_null, char **error) { if (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) { dest_fci->size = 0; @@ -1973,7 +1973,7 @@ static zend_always_inline int zend_parse_arg_func(zval *arg, zend_fcall_info *de return 1; } -static zend_always_inline void zend_parse_arg_zval(zval *arg, zval **dest, int check_null) +static zend_always_inline void zend_parse_arg_zval(zval *arg, zval **dest, bool check_null) { *dest = (check_null && (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) || @@ -1981,13 +1981,13 @@ static zend_always_inline void zend_parse_arg_zval(zval *arg, zval **dest, int c UNEXPECTED(Z_TYPE_P(Z_REFVAL_P(arg)) == IS_NULL)))) ? NULL : arg; } -static zend_always_inline void zend_parse_arg_zval_deref(zval *arg, zval **dest, int check_null) +static zend_always_inline void zend_parse_arg_zval_deref(zval *arg, zval **dest, bool check_null) { *dest = (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) ? NULL : arg; } -static zend_always_inline int zend_parse_arg_str_or_array_ht( - zval *arg, zend_string **dest_str, HashTable **dest_ht, int allow_null) +static zend_always_inline bool zend_parse_arg_str_or_array_ht( + zval *arg, zend_string **dest_str, HashTable **dest_ht, bool allow_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { *dest_str = Z_STR_P(arg); @@ -2005,8 +2005,8 @@ static zend_always_inline int zend_parse_arg_str_or_array_ht( return 1; } -static zend_always_inline int zend_parse_arg_str_or_long(zval *arg, zend_string **dest_str, zend_long *dest_long, - zend_bool *is_null, int allow_null) +static zend_always_inline bool zend_parse_arg_str_or_long(zval *arg, zend_string **dest_str, zend_long *dest_long, + zend_bool *is_null, bool allow_null) { if (allow_null) { *is_null = 0; @@ -2025,8 +2025,8 @@ static zend_always_inline int zend_parse_arg_str_or_long(zval *arg, zend_string return 1; } -static zend_always_inline int zend_parse_arg_class_name_or_obj( - zval *arg, zend_class_entry **destination, int allow_null +static zend_always_inline bool zend_parse_arg_class_name_or_obj( + zval *arg, zend_class_entry **destination, bool allow_null ) { if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { *destination = zend_lookup_class(Z_STR_P(arg)); @@ -2043,8 +2043,8 @@ static zend_always_inline int zend_parse_arg_class_name_or_obj( return 1; } -static zend_always_inline int zend_parse_arg_str_or_obj( - zval *arg, zend_string **destination_string, zend_object **destination_object, zend_class_entry *base_ce, int allow_null +static zend_always_inline bool zend_parse_arg_str_or_obj( + zval *arg, zend_string **destination_string, zend_object **destination_object, zend_class_entry *base_ce, bool allow_null ) { if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) { if (!base_ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), base_ce))) { diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 69b7baca40..098dda104a 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2203,7 +2203,7 @@ static void *tracked_malloc(size_t size); static void tracked_free_all(); #endif -void zend_mm_shutdown(zend_mm_heap *heap, int full, int silent) +void zend_mm_shutdown(zend_mm_heap *heap, bool full, bool silent) { zend_mm_chunk *p; zend_mm_huge_list *list; @@ -2365,7 +2365,7 @@ static size_t alloc_globals_offset; static zend_alloc_globals alloc_globals; #endif -ZEND_API int is_zend_mm(void) +ZEND_API bool is_zend_mm(void) { #if ZEND_MM_CUSTOM return !AG(mm_heap)->use_custom_heap; @@ -2374,7 +2374,7 @@ ZEND_API int is_zend_mm(void) #endif } -ZEND_API int is_zend_ptr(const void *ptr) +ZEND_API bool is_zend_ptr(const void *ptr) { #if ZEND_MM_CUSTOM if (AG(mm_heap)->use_custom_heap) { @@ -2658,15 +2658,14 @@ ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length) } -ZEND_API int zend_set_memory_limit(size_t memory_limit) +ZEND_API void zend_set_memory_limit(size_t memory_limit) { #if ZEND_MM_LIMIT AG(mm_heap)->limit = (memory_limit >= ZEND_MM_CHUNK_SIZE) ? memory_limit : ZEND_MM_CHUNK_SIZE; #endif - return SUCCESS; } -ZEND_API size_t zend_memory_usage(int real_usage) +ZEND_API size_t zend_memory_usage(bool real_usage) { #if ZEND_MM_STAT if (real_usage) { @@ -2679,7 +2678,7 @@ ZEND_API size_t zend_memory_usage(int real_usage) return 0; } -ZEND_API size_t zend_memory_peak_usage(int real_usage) +ZEND_API size_t zend_memory_peak_usage(bool real_usage) { #if ZEND_MM_STAT if (real_usage) { @@ -2691,7 +2690,7 @@ ZEND_API size_t zend_memory_peak_usage(int real_usage) return 0; } -ZEND_API void shutdown_memory_manager(int silent, int full_shutdown) +ZEND_API void shutdown_memory_manager(bool silent, bool full_shutdown) { zend_mm_shutdown(AG(mm_heap), full_shutdown, silent); } @@ -2858,7 +2857,7 @@ ZEND_API zend_mm_heap *zend_mm_get_heap(void) return AG(mm_heap); } -ZEND_API int zend_mm_is_custom_heap(zend_mm_heap *new_heap) +ZEND_API bool zend_mm_is_custom_heap(zend_mm_heap *new_heap) { #if ZEND_MM_CUSTOM return AG(mm_heap)->use_custom_heap; diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index 8bb854328d..ef97766eb5 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -219,15 +219,15 @@ ZEND_API void * __zend_realloc(void *p, size_t len) ZEND_ATTRIBUTE_ALLOC_SIZE(2) #define perealloc2_recoverable_rel(ptr, size, copy_size, persistent) ((persistent)?realloc((ptr), (size)):erealloc2_recoverable_rel((ptr), (size), (copy_size))) #define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s)) -ZEND_API int zend_set_memory_limit(size_t memory_limit); +ZEND_API void zend_set_memory_limit(size_t memory_limit); ZEND_API void start_memory_manager(void); -ZEND_API void shutdown_memory_manager(int silent, int full_shutdown); -ZEND_API int is_zend_mm(void); -ZEND_API int is_zend_ptr(const void *ptr); +ZEND_API void shutdown_memory_manager(bool silent, bool full_shutdown); +ZEND_API bool is_zend_mm(void); +ZEND_API bool is_zend_ptr(const void *ptr); -ZEND_API size_t zend_memory_usage(int real_usage); -ZEND_API size_t zend_memory_peak_usage(int real_usage); +ZEND_API size_t zend_memory_usage(bool real_usage); +ZEND_API size_t zend_memory_peak_usage(bool real_usage); /* fast cache for HashTables */ #define ALLOC_HASHTABLE(ht) \ @@ -246,7 +246,7 @@ ZEND_API size_t zend_memory_peak_usage(int real_usage); typedef struct _zend_mm_heap zend_mm_heap; ZEND_API zend_mm_heap *zend_mm_startup(void); -ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent); +ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, bool full_shutdown, bool silent); ZEND_API void* ZEND_FASTCALL _zend_mm_alloc(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; ZEND_API void ZEND_FASTCALL _zend_mm_free(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); ZEND_API void* ZEND_FASTCALL _zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); @@ -274,7 +274,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap); #define ZEND_MM_CUSTOM_HEAP_STD 1 #define ZEND_MM_CUSTOM_HEAP_DEBUG 2 -ZEND_API int zend_mm_is_custom_heap(zend_mm_heap *new_heap); +ZEND_API bool zend_mm_is_custom_heap(zend_mm_heap *new_heap); ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap, void* (*_malloc)(size_t), void (*_free)(void*), @@ -295,8 +295,8 @@ typedef struct _zend_mm_storage zend_mm_storage; typedef void* (*zend_mm_chunk_alloc_t)(zend_mm_storage *storage, size_t size, size_t alignment); typedef void (*zend_mm_chunk_free_t)(zend_mm_storage *storage, void *chunk, size_t size); -typedef int (*zend_mm_chunk_truncate_t)(zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size); -typedef int (*zend_mm_chunk_extend_t)(zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size); +typedef bool (*zend_mm_chunk_truncate_t)(zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size); +typedef bool (*zend_mm_chunk_extend_t)(zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size); typedef struct _zend_mm_handlers { zend_mm_chunk_alloc_t chunk_alloc; diff --git a/Zend/zend_arena.h b/Zend/zend_arena.h index 6ecc1fc85f..ff2d0a5fe6 100644 --- a/Zend/zend_arena.h +++ b/Zend/zend_arena.h @@ -78,7 +78,7 @@ static zend_always_inline void* zend_arena_alloc(zend_arena **arena_ptr, size_t static zend_always_inline void* zend_arena_calloc(zend_arena **arena_ptr, size_t count, size_t unit_size) { - int overflow; + bool overflow; size_t size; void *ret; @@ -174,7 +174,7 @@ static zend_always_inline void *zend_arena_alloc(zend_arena **arena_ptr, size_t static zend_always_inline void* zend_arena_calloc(zend_arena **arena_ptr, size_t count, size_t unit_size) { - int overflow; + bool overflow; size_t size; void *ret; diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index e2a2aca698..f746b408a1 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -438,7 +438,7 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_list_add(zend_ast *ast, zend_ast *op) return (zend_ast *) list; } -static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr) +static zend_result zend_ast_add_array_element(zval *result, zval *offset, zval *expr) { switch (Z_TYPE_P(offset)) { case IS_UNDEF: @@ -478,7 +478,7 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr) return SUCCESS; } -static int zend_ast_add_unpacked_element(zval *result, zval *expr) { +static zend_result zend_ast_add_unpacked_element(zval *result, zval *expr) { if (EXPECTED(Z_TYPE_P(expr) == IS_ARRAY)) { HashTable *ht = Z_ARRVAL_P(expr); zval *val; @@ -505,10 +505,10 @@ static int zend_ast_add_unpacked_element(zval *result, zval *expr) { return FAILURE; } -ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope) +ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope) { zval op1, op2; - int ret = SUCCESS; + zend_result ret = SUCCESS; switch (ast->kind) { case ZEND_AST_BINARY_OP: @@ -1059,7 +1059,7 @@ static ZEND_COLD void zend_ast_export_ns_name(smart_str *str, zend_ast *ast, int zend_ast_export_ex(str, ast, priority, indent); } -static ZEND_COLD int zend_ast_valid_var_char(char ch) +static ZEND_COLD bool zend_ast_valid_var_char(char ch) { unsigned char c = (unsigned char)ch; @@ -1072,7 +1072,7 @@ static ZEND_COLD int zend_ast_valid_var_char(char ch) return 1; } -static ZEND_COLD int zend_ast_valid_var_name(const char *s, size_t len) +static ZEND_COLD bool zend_ast_valid_var_name(const char *s, size_t len) { unsigned char c; size_t i; @@ -1098,7 +1098,7 @@ static ZEND_COLD int zend_ast_valid_var_name(const char *s, size_t len) return 1; } -static ZEND_COLD int zend_ast_var_needs_braces(char ch) +static ZEND_COLD bool zend_ast_var_needs_braces(char ch) { return ch == '[' || zend_ast_valid_var_char(ch); } @@ -1121,7 +1121,7 @@ static ZEND_COLD void zend_ast_export_var(smart_str *str, zend_ast *ast, int pri smart_str_appendc(str, '}'); } -static ZEND_COLD void zend_ast_export_list(smart_str *str, zend_ast_list *list, int separator, int priority, int indent) +static ZEND_COLD void zend_ast_export_list(smart_str *str, zend_ast_list *list, bool separator, int priority, int indent) { uint32_t i = 0; diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h index 97236c5560..2d72759c39 100644 --- a/Zend/zend_ast.h +++ b/Zend/zend_ast.h @@ -290,7 +290,7 @@ ZEND_API zend_ast *zend_ast_create_decl( zend_string *name, zend_ast *child0, zend_ast *child1, zend_ast *child2, zend_ast *child3, zend_ast *child4 ); -ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope); +ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope); ZEND_API zend_string *zend_ast_export(const char *prefix, zend_ast *ast, const char *suffix); ZEND_API zend_ast_ref * ZEND_FASTCALL zend_ast_copy(zend_ast *ast); diff --git a/Zend/zend_attributes.c b/Zend/zend_attributes.c index e55f27f84a..af5baa6ce0 100644 --- a/Zend/zend_attributes.c +++ b/Zend/zend_attributes.c @@ -116,7 +116,7 @@ ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, return get_attribute_str(attributes, str, len, offset + 1); } -ZEND_API int zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope) +ZEND_API zend_result zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope) { if (i >= attr->argc) { return FAILURE; @@ -175,7 +175,7 @@ ZEND_API zend_bool zend_is_attribute_repeated(HashTable *attributes, zend_attrib return 0; } -static zend_always_inline void free_attribute(zend_attribute *attr, int persistent) +static zend_always_inline void free_attribute(zend_attribute *attr, bool persistent) { uint32_t i; diff --git a/Zend/zend_attributes.h b/Zend/zend_attributes.h index 6b7150a363..6a60b06665 100644 --- a/Zend/zend_attributes.h +++ b/Zend/zend_attributes.h @@ -63,7 +63,7 @@ ZEND_API zend_attribute *zend_get_attribute_str(HashTable *attributes, const cha ZEND_API zend_attribute *zend_get_parameter_attribute(HashTable *attributes, zend_string *lcname, uint32_t offset); ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset); -ZEND_API int zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope); +ZEND_API zend_result zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope); ZEND_API zend_string *zend_get_attribute_target_names(uint32_t targets); ZEND_API zend_bool zend_is_attribute_repeated(HashTable *attributes, zend_attribute *attr); diff --git a/Zend/zend_bitset.h b/Zend/zend_bitset.h index 2a227e4822..9e196713f0 100644 --- a/Zend/zend_bitset.h +++ b/Zend/zend_bitset.h @@ -102,7 +102,7 @@ static inline void zend_bitset_clear(zend_bitset set, uint32_t len) memset(set, 0, len * ZEND_BITSET_ELM_SIZE); } -static inline int zend_bitset_empty(zend_bitset set, uint32_t len) +static inline bool zend_bitset_empty(zend_bitset set, uint32_t len) { uint32_t i; for (i = 0; i < len; i++) { diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 588c3c33d7..c3a2a1b63f 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -57,7 +57,7 @@ zend_module_entry zend_builtin_module = { /* {{{ */ }; /* }}} */ -int zend_startup_builtin_functions(void) /* {{{ */ +zend_result zend_startup_builtin_functions(void) /* {{{ */ { zend_builtin_module.module_number = 0; zend_builtin_module.type = MODULE_PERSISTENT; @@ -420,9 +420,9 @@ ZEND_FUNCTION(error_reporting) } /* }}} */ -static int validate_constant_array_argument(HashTable *ht, int argument_number) /* {{{ */ +static bool validate_constant_array_argument(HashTable *ht, int argument_number) /* {{{ */ { - int ret = 1; + bool ret = 1; zval *val; GC_PROTECT_RECURSION(ht); @@ -698,7 +698,7 @@ ZEND_FUNCTION(is_a) /* }}} */ /* {{{ add_class_vars */ -static void add_class_vars(zend_class_entry *scope, zend_class_entry *ce, int statics, zval *return_value) +static void add_class_vars(zend_class_entry *scope, zend_class_entry *ce, bool statics, zval *return_value) { zend_property_info *prop_info; zval *prop, prop_copy; @@ -865,10 +865,10 @@ ZEND_FUNCTION(get_mangled_object_vars) } /* }}} */ -static int same_name(zend_string *key, zend_string *name) /* {{{ */ +static bool same_name(zend_string *key, zend_string *name) /* {{{ */ { zend_string *lcname; - int ret; + bool ret; if (key == name) { return 1; @@ -2112,7 +2112,7 @@ ZEND_FUNCTION(get_extension_funcs) { zend_string *extension_name; zend_string *lcname; - int array; + bool array; zend_module_entry *module; zend_function *zif; diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h index cfc347ed41..a49dab1b46 100644 --- a/Zend/zend_builtin_functions.h +++ b/Zend/zend_builtin_functions.h @@ -20,7 +20,7 @@ #ifndef ZEND_BUILTIN_FUNCTIONS_H #define ZEND_BUILTIN_FUNCTIONS_H -int zend_startup_builtin_functions(void); +zend_result zend_startup_builtin_functions(void); BEGIN_EXTERN_C() ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit); diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 6b36bede37..630857f26c 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -273,7 +273,7 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ { } /* }}} */ -static int zend_create_closure_from_callable(zval *return_value, zval *callable, char **error) /* {{{ */ { +static zend_result zend_create_closure_from_callable(zval *return_value, zval *callable, char **error) /* {{{ */ { zend_fcall_info_cache fcc; zend_function *mptr; zval instance; @@ -361,6 +361,7 @@ static ZEND_COLD zend_function *zend_closure_get_constructor(zend_object *object } /* }}} */ +/* int return due to Object Handler API */ static int zend_closure_compare(zval *o1, zval *o2) /* {{{ */ { ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2); @@ -513,6 +514,7 @@ int zend_closure_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_f } /* }}} */ +/* *is_temp is int due to Object Handler API */ static HashTable *zend_closure_get_debug_info(zend_object *object, int *is_temp) /* {{{ */ { zend_closure *closure = (zend_closure *)object; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index a75c282d2d..b54b435ae9 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1076,7 +1076,7 @@ static zend_never_inline ZEND_COLD ZEND_NORETURN void do_bind_function_error(zen } } -ZEND_API int do_bind_function(zval *lcname) /* {{{ */ +ZEND_API zend_result do_bind_function(zval *lcname) /* {{{ */ { zend_function *function; zval *rtd_key, *zv; @@ -1097,7 +1097,7 @@ ZEND_API int do_bind_function(zval *lcname) /* {{{ */ } /* }}} */ -ZEND_API int do_bind_class(zval *lcname, zend_string *lc_parent_name) /* {{{ */ +ZEND_API zend_result do_bind_class(zval *lcname, zend_string *lc_parent_name) /* {{{ */ { zend_class_entry *ce; zval *rtd_key, *zv; @@ -1356,7 +1356,7 @@ ZEND_API void zend_do_delayed_early_binding(zend_op_array *op_array, uint32_t fi } /* }}} */ -ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, int internal) /* {{{ */ +ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, bool internal) /* {{{ */ { size_t prop_name_length = 1 + src1_length + 1 + src2_length; zend_string *prop_name = zend_string_alloc(prop_name_length, internal); @@ -1376,7 +1376,7 @@ static zend_always_inline size_t zend_strnlen(const char* s, size_t maxlen) /* { } /* }}} */ -ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len) /* {{{ */ +ZEND_API zend_result zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len) /* {{{ */ { size_t class_name_len; size_t anonclass_src_len; @@ -1749,10 +1749,10 @@ zend_bool zend_is_auto_global(zend_string *name) /* {{{ */ } /* }}} */ -int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback) /* {{{ */ +zend_result zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback) /* {{{ */ { zend_auto_global auto_global; - int retval; + zend_result retval; auto_global.name = name; auto_global.auto_global_callback = auto_global_callback; @@ -2105,7 +2105,7 @@ static inline uint32_t zend_emit_jump(uint32_t opnum_target) /* {{{ */ } /* }}} */ -ZEND_API int zend_is_smart_branch(const zend_op *opline) /* {{{ */ +ZEND_API bool zend_is_smart_branch(const zend_op *opline) /* {{{ */ { switch (opline->opcode) { case ZEND_IS_IDENTICAL: @@ -2419,7 +2419,7 @@ static void zend_emit_return_type_check( } /* }}} */ -void zend_emit_final_return(int return_one) /* {{{ */ +void zend_emit_final_return(bool return_one) /* {{{ */ { znode zn; zend_op *ret; @@ -2597,7 +2597,7 @@ static void zend_compile_class_ref(znode *result, zend_ast *name_ast, uint32_t f } /* }}} */ -static int zend_try_compile_cv(znode *result, zend_ast *ast) /* {{{ */ +static zend_result zend_try_compile_cv(znode *result, zend_ast *ast) /* {{{ */ { zend_ast *name_ast = ast->child[0]; if (name_ast->kind == ZEND_AST_ZVAL) { @@ -2628,7 +2628,7 @@ static int zend_try_compile_cv(znode *result, zend_ast *ast) /* {{{ */ } /* }}} */ -static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint32_t type, int delayed) /* {{{ */ +static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint32_t type, bool delayed) /* {{{ */ { zend_ast *name_ast = ast->child[0]; znode name_node; @@ -2679,7 +2679,7 @@ static zend_bool this_guaranteed_exists() /* {{{ */ } /* }}} */ -static zend_op *zend_compile_simple_var(znode *result, zend_ast *ast, uint32_t type, int delayed) /* {{{ */ +static zend_op *zend_compile_simple_var(znode *result, zend_ast *ast, uint32_t type, bool delayed) /* {{{ */ { if (is_this_fetch(ast)) { zend_op *opline = zend_emit_op(result, ZEND_FETCH_THIS, NULL, NULL); @@ -2814,7 +2814,7 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t } /* }}} */ -static zend_op *zend_compile_prop(znode *result, zend_ast *ast, uint32_t type, int by_ref) /* {{{ */ +static zend_op *zend_compile_prop(znode *result, zend_ast *ast, uint32_t type, bool by_ref) /* {{{ */ { uint32_t offset = zend_delayed_compile_begin(); zend_op *opline = zend_delayed_compile_prop(result, ast, type); @@ -2825,7 +2825,7 @@ static zend_op *zend_compile_prop(znode *result, zend_ast *ast, uint32_t type, i } /* }}} */ -zend_op *zend_compile_static_prop(znode *result, zend_ast *ast, uint32_t type, int by_ref, int delayed) /* {{{ */ +zend_op *zend_compile_static_prop(znode *result, zend_ast *ast, uint32_t type, bool by_ref, bool delayed) /* {{{ */ { zend_ast *class_ast = ast->child[0]; zend_ast *prop_ast = ast->child[1]; @@ -3637,7 +3637,7 @@ static inline zend_bool zend_args_contain_unpack_or_named(zend_ast_list *args) / } /* }}} */ -int zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */ { znode arg_node; @@ -3657,7 +3657,7 @@ int zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ +zend_result zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ { znode arg_node; zend_op *opline; @@ -3677,7 +3677,7 @@ int zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t typ } /* }}} */ -static int zend_compile_func_is_scalar(znode *result, zend_ast_list *args) /* {{{ */ +static zend_result zend_compile_func_is_scalar(znode *result, zend_ast_list *args) /* {{{ */ { znode arg_node; zend_op *opline; @@ -3692,7 +3692,7 @@ static int zend_compile_func_is_scalar(znode *result, zend_ast_list *args) /* {{ return SUCCESS; } -int zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ +zend_result zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */ { znode arg_node; zend_op *opline; @@ -3712,7 +3712,7 @@ int zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /* } /* }}} */ -int zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */ { zend_string *name; zend_op *opline; @@ -3744,7 +3744,7 @@ int zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_chr(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_chr(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children == 1 && @@ -3762,7 +3762,7 @@ int zend_compile_func_chr(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_ord(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_ord(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children == 1 && args->child[0]->kind == ZEND_AST_ZVAL && @@ -3784,7 +3784,7 @@ static zend_bool fbc_is_finalized(zend_function *fbc) { return !ZEND_USER_CODE(fbc->type) || (fbc->common.fn_flags & ZEND_ACC_DONE_PASS_TWO); } -static int zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast, uint32_t num_args) /* {{{ */ +static zend_result zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast, uint32_t num_args) /* {{{ */ { zend_string *name, *lcname; zend_function *fbc; @@ -3837,7 +3837,7 @@ static void zend_compile_init_user_func(zend_ast *name_ast, uint32_t num_args, z /* }}} */ /* cufa = call_user_func_array */ -int zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ +zend_result zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ { znode arg_node; @@ -3887,7 +3887,7 @@ int zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcna /* }}} */ /* cuf = call_user_func */ -int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ +zend_result zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ { uint32_t i; @@ -3958,7 +3958,7 @@ static void zend_compile_assert(znode *result, zend_ast_list *args, zend_string } /* }}} */ -static int zend_compile_func_in_array(znode *result, zend_ast_list *args) /* {{{ */ +static zend_result zend_compile_func_in_array(znode *result, zend_ast_list *args) /* {{{ */ { zend_bool strict = 0; znode array, needly; @@ -4043,7 +4043,7 @@ static int zend_compile_func_in_array(znode *result, zend_ast_list *args) /* {{{ } /* }}} */ -int zend_compile_func_count(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ +zend_result zend_compile_func_count(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ { znode arg_node; zend_op *opline; @@ -4060,7 +4060,7 @@ int zend_compile_func_count(znode *result, zend_ast_list *args, zend_string *lcn } /* }}} */ -int zend_compile_func_get_class(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_get_class(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children == 0) { zend_emit_op_tmp(result, ZEND_GET_CLASS, NULL, NULL); @@ -4078,7 +4078,7 @@ int zend_compile_func_get_class(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_get_called_class(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_get_called_class(znode *result, zend_ast_list *args) /* {{{ */ { if (args->children != 0) { return FAILURE; @@ -4089,7 +4089,7 @@ int zend_compile_func_get_called_class(znode *result, zend_ast_list *args) /* {{ } /* }}} */ -int zend_compile_func_gettype(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_gettype(znode *result, zend_ast_list *args) /* {{{ */ { znode arg_node; @@ -4103,7 +4103,7 @@ int zend_compile_func_gettype(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_num_args(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_num_args(znode *result, zend_ast_list *args) /* {{{ */ { if (CG(active_op_array)->function_name && args->children == 0) { zend_emit_op_tmp(result, ZEND_FUNC_NUM_ARGS, NULL, NULL); @@ -4114,7 +4114,7 @@ int zend_compile_func_num_args(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_get_args(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_get_args(znode *result, zend_ast_list *args) /* {{{ */ { if (CG(active_op_array)->function_name && args->children == 0) { zend_emit_op_tmp(result, ZEND_FUNC_GET_ARGS, NULL, NULL); @@ -4125,7 +4125,7 @@ int zend_compile_func_get_args(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_compile_func_array_key_exists(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_array_key_exists(znode *result, zend_ast_list *args) /* {{{ */ { znode subject, needle; @@ -4141,7 +4141,7 @@ int zend_compile_func_array_key_exists(znode *result, zend_ast_list *args) /* {{ } /* }}} */ -int zend_compile_func_array_slice(znode *result, zend_ast_list *args) /* {{{ */ +zend_result zend_compile_func_array_slice(znode *result, zend_ast_list *args) /* {{{ */ { if (CG(active_op_array)->function_name && args->children == 2 @@ -4174,7 +4174,7 @@ int zend_compile_func_array_slice(znode *result, zend_ast_list *args) /* {{{ */ } /* }}} */ -int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_list *args, zend_function *fbc, uint32_t type) /* {{{ */ +zend_result zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_list *args, zend_function *fbc, uint32_t type) /* {{{ */ { if (CG(compiler_options) & ZEND_COMPILE_NO_BUILTINS) { return FAILURE; @@ -4641,7 +4641,7 @@ void zend_compile_unset(zend_ast *ast) /* {{{ */ } /* }}} */ -static int zend_handle_loops_and_finally_ex(zend_long depth, znode *return_value) /* {{{ */ +static bool zend_handle_loops_and_finally_ex(zend_long depth, znode *return_value) /* {{{ */ { zend_loop_var *base; zend_loop_var *loop_var = zend_stack_top(&CG(loop_var_stack)); @@ -4690,13 +4690,13 @@ static int zend_handle_loops_and_finally_ex(zend_long depth, znode *return_value } /* }}} */ -static int zend_handle_loops_and_finally(znode *return_value) /* {{{ */ +static bool zend_handle_loops_and_finally(znode *return_value) /* {{{ */ { return zend_handle_loops_and_finally_ex(zend_stack_count(&CG(loop_var_stack)) + 1, return_value); } /* }}} */ -static int zend_has_finally_ex(zend_long depth) /* {{{ */ +static bool zend_has_finally_ex(zend_long depth) /* {{{ */ { zend_loop_var *base; zend_loop_var *loop_var = zend_stack_top(&CG(loop_var_stack)); @@ -4722,7 +4722,7 @@ static int zend_has_finally_ex(zend_long depth) /* {{{ */ } /* }}} */ -static int zend_has_finally(void) /* {{{ */ +static bool zend_has_finally(void) /* {{{ */ { return zend_has_finally_ex(zend_stack_count(&CG(loop_var_stack)) + 1); } @@ -5859,7 +5859,7 @@ zend_bool zend_handle_encoding_declaration(zend_ast *ast) /* {{{ */ } /* }}} */ -static int zend_declare_is_first_statement(zend_ast *ast) /* {{{ */ +static zend_result zend_declare_is_first_statement(zend_ast *ast) /* {{{ */ { uint32_t i = 0; zend_ast_list *file_ast = zend_ast_get_list(CG(ast)); @@ -9603,7 +9603,7 @@ void zend_compile_expr(znode *result, zend_ast *ast) zend_short_circuiting_commit(checkpoint, result, ast); } -static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t type, int by_ref) +static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t type, bool by_ref) { CG(zend_lineno) = zend_ast_get_lineno(ast); @@ -9641,7 +9641,7 @@ static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t ty } } -zend_op *zend_compile_var(znode *result, zend_ast *ast, uint32_t type, int by_ref) /* {{{ */ +zend_op *zend_compile_var(znode *result, zend_ast *ast, uint32_t type, bool by_ref) /* {{{ */ { uint32_t checkpoint = zend_short_circuiting_checkpoint(); zend_op *opcode = zend_compile_var_inner(result, ast, type, by_ref); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index df3171f76d..e50f620ed4 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -133,7 +133,7 @@ typedef union _zend_parser_stack_elem { void zend_compile_top_stmt(zend_ast *ast); void zend_compile_stmt(zend_ast *ast); void zend_compile_expr(znode *node, zend_ast *ast); -zend_op *zend_compile_var(znode *node, zend_ast *ast, uint32_t type, int by_ref); +zend_op *zend_compile_var(znode *node, zend_ast *ast, uint32_t type, bool by_ref); void zend_eval_const_expr(zend_ast **ast_ptr); void zend_const_expr_to_zval(zval *result, zend_ast *ast); @@ -751,14 +751,14 @@ const char *zend_get_zendtext(void); int zend_get_zendleng(void); #endif -typedef int (ZEND_FASTCALL *unary_op_type)(zval *, zval *); -typedef int (ZEND_FASTCALL *binary_op_type)(zval *, zval *, zval *); +typedef zend_result (ZEND_FASTCALL *unary_op_type)(zval *, zval *); +typedef zend_result (ZEND_FASTCALL *binary_op_type)(zval *, zval *, zval *); ZEND_API unary_op_type get_unary_op(int opcode); ZEND_API binary_op_type get_binary_op(int opcode); void zend_stop_lexing(void); -void zend_emit_final_return(int return_one); +void zend_emit_final_return(bool return_one); /* Used during AST construction */ zend_ast *zend_ast_append_str(zend_ast *left, zend_ast *right); @@ -770,8 +770,8 @@ zend_bool zend_handle_encoding_declaration(zend_ast *ast); /* parser-driven code generators */ void zend_do_free(znode *op1); -ZEND_API int do_bind_function(zval *lcname); -ZEND_API int do_bind_class(zval *lcname, zend_string *lc_parent_name); +ZEND_API zend_result do_bind_function(zval *lcname); +ZEND_API zend_result do_bind_class(zval *lcname, zend_string *lc_parent_name); ZEND_API uint32_t zend_build_delayed_early_binding_list(const zend_op_array *op_array); ZEND_API void zend_do_delayed_early_binding(zend_op_array *op_array, uint32_t first_early_binding_opline); @@ -823,10 +823,10 @@ ZEND_API void zend_function_dtor(zval *zv); ZEND_API void destroy_zend_class(zval *zv); void zend_class_add_ref(zval *zv); -ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, int internal); +ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, bool internal); #define zend_unmangle_property_name(mangled_property, class_name, prop_name) \ zend_unmangle_property_name_ex(mangled_property, class_name, prop_name, NULL) -ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len); +ZEND_API zend_result zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len); static zend_always_inline const char *zend_get_unmangled_property_name(const zend_string *mangled_prop) { const char *class_name, *prop_name; @@ -841,13 +841,13 @@ typedef zend_bool (*zend_needs_live_range_cb)(zend_op_array *op_array, zend_op * ZEND_API void zend_recalc_live_ranges( zend_op_array *op_array, zend_needs_live_range_cb needs_live_range); -ZEND_API int pass_two(zend_op_array *op_array); +ZEND_API void pass_two(zend_op_array *op_array); ZEND_API zend_bool zend_is_compiling(void); ZEND_API char *zend_make_compiled_string_description(const char *name); ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers); uint32_t zend_get_class_fetch_type(zend_string *name); ZEND_API zend_uchar zend_get_call_op(const zend_op *init_op, zend_function *fbc); -ZEND_API int zend_is_smart_branch(const zend_op *opline); +ZEND_API bool zend_is_smart_branch(const zend_op *opline); typedef zend_bool (*zend_auto_global_callback)(zend_string *name); typedef struct _zend_auto_global { @@ -857,7 +857,7 @@ typedef struct _zend_auto_global { zend_bool armed; } zend_auto_global; -ZEND_API int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback); +ZEND_API zend_result zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback); ZEND_API void zend_activate_auto_globals(void); ZEND_API zend_bool zend_is_auto_global(zend_string *name); ZEND_API zend_bool zend_is_auto_global_str(const char *name, size_t len); @@ -974,7 +974,7 @@ ZEND_API zend_string *zend_type_to_string(zend_type type); #define IS_CONSTANT_CLASS 0x400 /* __CLASS__ in trait */ #define IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE 0x800 -static zend_always_inline int zend_check_arg_send_type(const zend_function *zf, uint32_t arg_num, uint32_t mask) +static zend_always_inline bool zend_check_arg_send_type(const zend_function *zf, uint32_t arg_num, uint32_t mask) { arg_num--; if (UNEXPECTED(arg_num >= zf->common.num_args)) { diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index fe37e3fbd0..3ad32446ff 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -98,12 +98,10 @@ void clean_module_constants(int module_number) zend_hash_apply_with_argument(EG(zend_constants), clean_module_constant, (void *) &module_number); } - -int zend_startup_constants(void) +void zend_startup_constants(void) { EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable)); zend_hash_init(EG(zend_constants), 128, NULL, ZEND_CONSTANT_DTOR, 1); - return SUCCESS; } @@ -144,11 +142,10 @@ void zend_register_standard_constants(void) } -int zend_shutdown_constants(void) +void zend_shutdown_constants(void) { zend_hash_destroy(EG(zend_constants)); free(EG(zend_constants)); - return SUCCESS; } ZEND_API void zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number) @@ -266,7 +263,7 @@ ZEND_API zend_constant *_zend_get_special_const(const char *name, size_t len) /* } /* }}} */ -ZEND_API int zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */ +ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */ { if (Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PUBLIC) { return 1; @@ -396,7 +393,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, } if (ret_constant && Z_TYPE_P(ret_constant) == IS_CONSTANT_AST) { - int ret; + zend_result ret; if (IS_CONSTANT_VISITED(ret_constant)) { zend_throw_error(NULL, "Cannot declare self-referencing constant %s::%s", ZSTR_VAL(class_name), ZSTR_VAL(constant_name)); @@ -480,11 +477,11 @@ static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_consta return ret; } -ZEND_API int zend_register_constant(zend_constant *c) +ZEND_API zend_result zend_register_constant(zend_constant *c) { zend_string *lowercase_name = NULL; zend_string *name; - int ret = SUCCESS; + zend_result ret = SUCCESS; zend_bool persistent = (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) != 0; #if 0 diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h index 9b5a63a026..0a3c5a7377 100644 --- a/Zend/zend_constants.h +++ b/Zend/zend_constants.h @@ -69,10 +69,10 @@ typedef struct _zend_constant { BEGIN_EXTERN_C() void clean_module_constants(int module_number); void free_zend_constant(zval *zv); -int zend_startup_constants(void); -int zend_shutdown_constants(void); +void zend_startup_constants(void); +void zend_shutdown_constants(void); void zend_register_standard_constants(void); -ZEND_API int zend_verify_const_access(zend_class_constant *c, zend_class_entry *ce); +ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *ce); ZEND_API zval *zend_get_constant(zend_string *name); ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len); ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, uint32_t flags); @@ -82,7 +82,7 @@ ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zen ZEND_API void zend_register_double_constant(const char *name, size_t name_len, double dval, int flags, int module_number); ZEND_API void zend_register_string_constant(const char *name, size_t name_len, const char *strval, int flags, int module_number); ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, const char *strval, size_t strlen, int flags, int module_number); -ZEND_API int zend_register_constant(zend_constant *c); +ZEND_API zend_result zend_register_constant(zend_constant *c); #ifdef ZTS void zend_copy_constants(HashTable *target, HashTable *sourc); #endif diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 2923165e56..7184f5bf68 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -213,7 +213,7 @@ ZEND_API void zend_clear_exception(void) /* {{{ */ } /* }}} */ -static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces) /* {{{ */ +static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, bool skip_top_traces) /* {{{ */ { zval tmp; zval trace; @@ -908,11 +908,11 @@ static void zend_error_va(int type, const char *file, uint32_t lineno, const cha /* }}} */ /* This function doesn't return if it uses E_ERROR */ -ZEND_API ZEND_COLD int zend_exception_error(zend_object *ex, int severity) /* {{{ */ +ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severity) /* {{{ */ { zval exception, rv; zend_class_entry *ce_exception; - int result = FAILURE; + zend_result result = FAILURE; ZVAL_OBJ(&exception, ex); ce_exception = ex->ce; diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index 7e8c73b1e9..9d0c18a6da 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -67,7 +67,7 @@ ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, extern ZEND_API void (*zend_throw_exception_hook)(zend_object *ex); /* show an exception using zend_error(severity,...), severity should be E_ERROR */ -ZEND_API ZEND_COLD int zend_exception_error(zend_object *exception, int severity); +ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *exception, int severity); ZEND_API ZEND_COLD void zend_throw_unwind_exit(void); ZEND_API zend_bool zend_is_unwind_exit(zend_object *ex); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index bdcb2ce175..12660b6ef2 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -568,7 +568,7 @@ static zend_never_inline zval* zend_assign_to_typed_property_reference(zend_prop return prop; } -static zend_never_inline ZEND_COLD int zend_wrong_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr OPLINE_DC EXECUTE_DATA_DC) +static zend_never_inline ZEND_COLD bool zend_wrong_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr OPLINE_DC EXECUTE_DATA_DC) { zend_error(E_NOTICE, "Only variables should be assigned by reference"); if (UNEXPECTED(EG(exception) != NULL)) { @@ -1035,7 +1035,7 @@ static zend_always_inline zend_bool zend_check_type( return zend_check_type_slow(type, arg, ref, cache_slot, scope, is_return_type, is_internal); } -static zend_always_inline int zend_verify_recv_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, void **cache_slot) +static zend_always_inline bool zend_verify_recv_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, void **cache_slot) { zend_arg_info *cur_arg_info; @@ -1051,7 +1051,7 @@ static zend_always_inline int zend_verify_recv_arg_type(zend_function *zf, uint3 return 1; } -static zend_always_inline int zend_verify_variadic_arg_type( +static zend_always_inline bool zend_verify_variadic_arg_type( zend_function *zf, zend_arg_info *arg_info, uint32_t arg_num, zval *arg, void **cache_slot) { ZEND_ASSERT(ZEND_TYPE_IS_SET(arg_info->type)); @@ -1063,7 +1063,7 @@ static zend_always_inline int zend_verify_variadic_arg_type( return 1; } -static zend_never_inline ZEND_ATTRIBUTE_UNUSED int zend_verify_internal_arg_types(zend_function *fbc, zend_execute_data *call) +static zend_never_inline ZEND_ATTRIBUTE_UNUSED bool zend_verify_internal_arg_types(zend_function *fbc, zend_execute_data *call) { uint32_t i; uint32_t num_args = ZEND_CALL_NUM_ARGS(call); @@ -1203,7 +1203,7 @@ static ZEND_COLD void zend_verify_void_return_error(const zend_function *zf, con fclass, fsep, fname, returned_msg, returned_kind); } -static int zend_verify_internal_return_type(zend_function *zf, zval *ret) +static bool zend_verify_internal_return_type(zend_function *zf, zval *ret) { zend_internal_arg_info *ret_info = zf->internal_function.arg_info - 1; void *dummy_cache_slot = NULL; @@ -1225,11 +1225,10 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret) } #endif -static ZEND_COLD int zend_verify_missing_return_type(const zend_function *zf, void **cache_slot) +static ZEND_COLD void zend_verify_missing_return_type(const zend_function *zf, void **cache_slot) { /* VERIFY_RETURN_TYPE is not emitted for "void" functions, so this is always an error. */ zend_verify_return_error(zf, cache_slot, NULL); - return 0; } static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_object_as_array(void) @@ -1900,7 +1899,7 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_undefined_index(const zend_error(E_WARNING, "Undefined array key \"%s\"", ZSTR_VAL(offset)); } -ZEND_API ZEND_COLD int ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval) +ZEND_API ZEND_COLD zend_result ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval) { /* The array may be destroyed while throwing the notice. * Temporarily increase the refcount to detect this situation. */ @@ -1918,7 +1917,7 @@ ZEND_API ZEND_COLD int ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, return SUCCESS; } -ZEND_API ZEND_COLD int ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset) +ZEND_API ZEND_COLD zend_result ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset) { /* The array may be destroyed while throwing the notice. * Temporarily increase the refcount to detect this situation. */ @@ -2307,7 +2306,7 @@ static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_UNSET(z zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET EXECUTE_DATA_CC); } -static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, int is_list, int slow EXECUTE_DATA_DC) +static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, bool is_list, int slow EXECUTE_DATA_DC) { zval *retval; @@ -2482,7 +2481,7 @@ str_idx: } } -static zend_never_inline int ZEND_FASTCALL zend_isset_dim_slow(zval *container, zval *offset EXECUTE_DATA_DC) +static zend_never_inline bool ZEND_FASTCALL zend_isset_dim_slow(zval *container, zval *offset EXECUTE_DATA_DC) { if (/*OP2_TYPE == IS_CV &&*/ UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) { offset = ZVAL_UNDEFINED_OP2(); @@ -2521,7 +2520,7 @@ str_offset: } } -static zend_never_inline int ZEND_FASTCALL zend_isempty_dim_slow(zval *container, zval *offset EXECUTE_DATA_DC) +static zend_never_inline bool ZEND_FASTCALL zend_isempty_dim_slow(zval *container, zval *offset EXECUTE_DATA_DC) { if (/*OP2_TYPE == IS_CV &&*/ UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) { offset = ZVAL_UNDEFINED_OP2(); @@ -2890,7 +2889,7 @@ static zend_never_inline void zend_assign_to_property_reference_var_var(zval *co OPLINE_CC EXECUTE_DATA_CC); } -static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type OPLINE_DC EXECUTE_DATA_DC) { +static zend_never_inline zend_result zend_fetch_static_property_address_ex(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type OPLINE_DC EXECUTE_DATA_DC) { zend_string *name; zend_class_entry *ce; zend_property_info *property_info; @@ -2968,8 +2967,7 @@ static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval } -static zend_always_inline int zend_fetch_static_property_address(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type, int flags OPLINE_DC EXECUTE_DATA_DC) { - int success; +static zend_always_inline zend_result zend_fetch_static_property_address(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type, int flags OPLINE_DC EXECUTE_DATA_DC) { zend_property_info *property_info; if (opline->op1_type == IS_CONST && (opline->op2_type == IS_CONST || (opline->op2_type == IS_UNUSED && (opline->op2.num == ZEND_FETCH_CLASS_SELF || opline->op2.num == ZEND_FETCH_CLASS_PARENT))) && EXPECTED(CACHED_PTR(cache_slot) != NULL)) { @@ -2985,6 +2983,7 @@ static zend_always_inline int zend_fetch_static_property_address(zval **retval, return FAILURE; } } else { + zend_result success; success = zend_fetch_static_property_address_ex(retval, &property_info, cache_slot, fetch_type OPLINE_CC EXECUTE_DATA_CC); if (UNEXPECTED(success != SUCCESS)) { return FAILURE; @@ -3348,7 +3347,7 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_wrong_clone_call(zend zend_hash_apply(EX(symbol_table), zend_check_symbol); \ } -static int zend_check_symbol(zval *pz) +static void zend_check_symbol(zval *pz) { if (Z_TYPE_P(pz) == IS_INDIRECT) { pz = Z_INDIRECT_P(pz); @@ -3365,8 +3364,6 @@ static int zend_check_symbol(zval *pz) /* OBJ-TBI - doesn't support new object model! */ zend_hash_apply(Z_OBJPROP_P(pz), zend_check_symbol); } - - return 0; } @@ -4286,8 +4283,8 @@ static zend_never_inline zend_bool ZEND_FASTCALL zend_fe_reset_iterator(zval *ar } /* }}} */ -static zend_always_inline int _zend_quick_get_constant( - const zval *key, uint32_t flags, int check_defined_only OPLINE_DC EXECUTE_DATA_DC) /* {{{ */ +static zend_always_inline zend_result _zend_quick_get_constant( + const zval *key, uint32_t flags, bool check_defined_only OPLINE_DC EXECUTE_DATA_DC) /* {{{ */ { zval *zv; zend_constant *c = NULL; @@ -4331,7 +4328,7 @@ static zend_never_inline void ZEND_FASTCALL zend_quick_get_constant( _zend_quick_get_constant(key, flags, 0 OPLINE_CC EXECUTE_DATA_CC); } /* }}} */ -static zend_never_inline int ZEND_FASTCALL zend_quick_check_constant( +static zend_never_inline zend_result ZEND_FASTCALL zend_quick_check_constant( const zval *key OPLINE_DC EXECUTE_DATA_DC) /* {{{ */ { return _zend_quick_get_constant(key, 0, 1 OPLINE_CC EXECUTE_DATA_CC); @@ -4454,7 +4451,7 @@ static void end_fake_frame(zend_execute_data *call) { } } -ZEND_API int ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call) { +ZEND_API zend_result ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call) { zend_function *fbc = call->func; if (fbc->type == ZEND_USER_FUNCTION) { uint32_t num_args = ZEND_CALL_NUM_ARGS(call); @@ -4482,7 +4479,7 @@ ZEND_API int ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call) { zval tmp; ZVAL_COPY(&tmp, default_value); start_fake_frame(call, opline); - int ret = zval_update_constant_ex(&tmp, fbc->op_array.scope); + zend_result ret = zval_update_constant_ex(&tmp, fbc->op_array.scope); end_fake_frame(call); if (UNEXPECTED(ret == FAILURE)) { zval_ptr_dtor_nogc(&tmp); @@ -4537,7 +4534,7 @@ ZEND_API int ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call) { if (Z_TYPE(default_value) == IS_CONSTANT_AST) { start_fake_frame(call, NULL); - int ret = zval_update_constant_ex(&default_value, fbc->common.scope); + zend_result ret = zval_update_constant_ex(&default_value, fbc->common.scope); end_fake_frame(call); if (ret == FAILURE) { return FAILURE; @@ -4754,7 +4751,7 @@ static zend_always_inline zend_execute_data *_zend_vm_stack_push_call_frame(uint #include "zend_vm_execute.h" -ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler) +ZEND_API zend_result zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler) { if (opcode != ZEND_USER_OPCODE) { if (handler == NULL) { diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 9bf4a5aeb0..7671dfe555 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -48,10 +48,10 @@ ZEND_API zend_class_entry *zend_lookup_class(zend_string *name); ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags); ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex); ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex); -ZEND_API int zend_eval_string(const char *str, zval *retval_ptr, const char *string_name); -ZEND_API int zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name); -ZEND_API int zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, int handle_exceptions); -ZEND_API int zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, int handle_exceptions); +ZEND_API zend_result zend_eval_string(const char *str, zval *retval_ptr, const char *string_name); +ZEND_API zend_result zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name); +ZEND_API zend_result zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, bool handle_exceptions); +ZEND_API zend_result zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, bool handle_exceptions); /* export zend_pass_function to allow comparisons against it */ extern ZEND_API const zend_internal_function zend_pass_function; @@ -65,8 +65,8 @@ ZEND_API zend_bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(zend_propert ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(zend_property_info *prop, zval *zv); ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(zend_property_info *prop1, zend_property_info *prop2, zval *zv); -ZEND_API ZEND_COLD int ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval); -ZEND_API ZEND_COLD int ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset); +ZEND_API ZEND_COLD zend_result ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval); +ZEND_API ZEND_COLD zend_result ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset); ZEND_API zend_bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, zend_bool strict, zend_bool is_internal_arg); ZEND_API ZEND_COLD void zend_verify_arg_error( @@ -156,8 +156,8 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval return variable_ptr; } -ZEND_API int zval_update_constant(zval *pp); -ZEND_API int zval_update_constant_ex(zval *pp, zend_class_entry *scope); +ZEND_API zend_result zval_update_constant(zval *pp); +ZEND_API zend_result zval_update_constant_ex(zval *pp, zend_class_entry *scope); /* dedicated Zend executor functions - do not use! */ struct _zend_vm_stack { @@ -318,7 +318,7 @@ ZEND_API uint32_t zend_get_executed_lineno(void); ZEND_API zend_class_entry *zend_get_executed_scope(void); ZEND_API zend_bool zend_is_executing(void); -ZEND_API void zend_set_timeout(zend_long seconds, int reset_signals); +ZEND_API void zend_set_timeout(zend_long seconds, bool reset_signals); ZEND_API void zend_unset_timeout(void); ZEND_API ZEND_NORETURN void ZEND_FASTCALL zend_timeout(void); ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 026a29bffc..2fd465acec 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -56,7 +56,7 @@ ZEND_TLS HANDLE tq_timer = NULL; #if 0&&ZEND_DEBUG static void (*original_sigsegv_handler)(int); -static void zend_handle_sigsegv(int dummy) /* {{{ */ +static void zend_handle_sigsegv(void) /* {{{ */ { fflush(stdout); fflush(stderr); @@ -585,7 +585,7 @@ ZEND_API zend_bool zend_is_executing(void) /* {{{ */ } /* }}} */ -ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */ +ZEND_API zend_result zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */ { if (Z_TYPE_P(p) == IS_CONSTANT_AST) { zend_ast *ast = Z_ASTVAL_P(p); @@ -613,13 +613,13 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */ } /* }}} */ -ZEND_API int zval_update_constant(zval *pp) /* {{{ */ +ZEND_API zend_result zval_update_constant(zval *pp) /* {{{ */ { return zval_update_constant_ex(pp, EG(current_execute_data) ? zend_get_executed_scope() : CG(active_class_entry)); } /* }}} */ -int _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params) /* {{{ */ +zend_result _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params) /* {{{ */ { zend_fcall_info fci; @@ -635,7 +635,7 @@ int _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr } /* }}} */ -int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /* {{{ */ +zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /* {{{ */ { uint32_t i; zend_execute_data *call, dummy_execute_data; @@ -956,7 +956,7 @@ ZEND_API void zend_call_known_function( fcic.object = object; fcic.called_scope = called_scope; - int result = zend_call_function(&fci, &fcic); + zend_result result = zend_call_function(&fci, &fcic); if (UNEXPECTED(result == FAILURE)) { if (!EG(exception)) { zend_error_noreturn(E_CORE_ERROR, "Couldn't execute method %s%s%s", @@ -1134,12 +1134,12 @@ ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex) /* {{{ */ } /* }}} */ -ZEND_API int zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name) /* {{{ */ +ZEND_API zend_result zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name) /* {{{ */ { zval pv; zend_op_array *new_op_array; uint32_t original_compiler_options; - int retval; + zend_result retval; if (retval_ptr) { ZVAL_NEW_STR(&pv, zend_string_alloc(str_len + sizeof("return ;")-1, 0)); @@ -1198,15 +1198,15 @@ ZEND_API int zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr } /* }}} */ -ZEND_API int zend_eval_string(const char *str, zval *retval_ptr, const char *string_name) /* {{{ */ +ZEND_API zend_result zend_eval_string(const char *str, zval *retval_ptr, const char *string_name) /* {{{ */ { return zend_eval_stringl(str, strlen(str), retval_ptr, string_name); } /* }}} */ -ZEND_API int zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, int handle_exceptions) /* {{{ */ +ZEND_API zend_result zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, bool handle_exceptions) /* {{{ */ { - int result; + zend_result result; result = zend_eval_stringl(str, str_len, retval_ptr, string_name); if (handle_exceptions && EG(exception)) { @@ -1216,13 +1216,13 @@ ZEND_API int zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ } /* }}} */ -ZEND_API int zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, int handle_exceptions) /* {{{ */ +ZEND_API zend_result zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, bool handle_exceptions) /* {{{ */ { return zend_eval_stringl_ex(str, strlen(str), retval_ptr, string_name, handle_exceptions); } /* }}} */ -static void zend_set_timeout_ex(zend_long seconds, int reset_signals); +static void zend_set_timeout_ex(zend_long seconds, bool reset_signals); ZEND_API ZEND_NORETURN void ZEND_FASTCALL zend_timeout(void) /* {{{ */ { @@ -1322,7 +1322,7 @@ VOID CALLBACK tq_timer_cb(PVOID arg, BOOLEAN timed_out) #define SIGPROF 27 #endif -static void zend_set_timeout_ex(zend_long seconds, int reset_signals) /* {{{ */ +static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */ { #ifdef ZEND_WIN32 zend_executor_globals *eg; @@ -1394,7 +1394,7 @@ static void zend_set_timeout_ex(zend_long seconds, int reset_signals) /* {{{ */ } /* }}} */ -void zend_set_timeout(zend_long seconds, int reset_signals) /* {{{ */ +void zend_set_timeout(zend_long seconds, bool reset_signals) /* {{{ */ { EG(timeout_seconds) = seconds; @@ -1525,7 +1525,7 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string } /* }}} */ -ZEND_API int zend_delete_global_variable(zend_string *name) /* {{{ */ +ZEND_API zend_result zend_delete_global_variable(zend_string *name) /* {{{ */ { return zend_hash_del_ind(&EG(symbol_table), name); } @@ -1638,7 +1638,7 @@ ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data) /* {{{ * } /* }}} */ -ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force) /* {{{ */ +ZEND_API zend_result zend_set_local_var(zend_string *name, zval *value, bool force) /* {{{ */ { zend_execute_data *execute_data = EG(current_execute_data); @@ -1681,7 +1681,7 @@ ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force) /* {{ } /* }}} */ -ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force) /* {{{ */ +ZEND_API zend_result zend_set_local_var_str(const char *name, size_t len, zval *value, bool force) /* {{{ */ { zend_execute_data *execute_data = EG(current_execute_data); diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index 2509daf318..c44a2f3093 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -24,7 +24,7 @@ ZEND_API uint32_t zend_extension_flags = 0; ZEND_API int zend_op_array_extension_handles = 0; static int last_resource_number; -int zend_load_extension(const char *path) +zend_result zend_load_extension(const char *path) { #if ZEND_EXTENSIONS_SUPPORT DL_HANDLE handle; @@ -51,7 +51,7 @@ int zend_load_extension(const char *path) #endif } -int zend_load_extension_handle(DL_HANDLE handle, const char *path) +zend_result zend_load_extension_handle(DL_HANDLE handle, const char *path) { #if ZEND_EXTENSIONS_SUPPORT zend_extension *new_extension; @@ -126,7 +126,8 @@ int zend_load_extension_handle(DL_HANDLE handle, const char *path) return FAILURE; } - return zend_register_extension(new_extension, handle); + zend_register_extension(new_extension, handle); + return SUCCESS; #else fprintf(stderr, "Extensions are not supported on this platform.\n"); /* See http://support.microsoft.com/kb/190351 */ @@ -138,7 +139,7 @@ int zend_load_extension_handle(DL_HANDLE handle, const char *path) } -int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) +void zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) { #if ZEND_EXTENSIONS_SUPPORT zend_extension extension; @@ -167,8 +168,6 @@ int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) } /*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/ #endif - - return SUCCESS; } @@ -181,6 +180,7 @@ static void zend_extension_shutdown(zend_extension *extension) #endif } +/* int return due to zend linked list API */ static int zend_extension_startup(zend_extension *extension) { #if ZEND_EXTENSIONS_SUPPORT @@ -195,20 +195,18 @@ static int zend_extension_startup(zend_extension *extension) } -int zend_startup_extensions_mechanism() +void zend_startup_extensions_mechanism() { /* Startup extensions mechanism */ zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1); zend_op_array_extension_handles = 0; last_resource_number = 0; - return SUCCESS; } -int zend_startup_extensions() +void zend_startup_extensions() { zend_llist_apply_with_del(&zend_extensions, (int (*)(void *)) zend_extension_startup); - return SUCCESS; } diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index 59cd970b3a..a26a6f9fc7 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -140,14 +140,14 @@ ZEND_API extern uint32_t zend_extension_flags; void zend_extension_dtor(zend_extension *extension); ZEND_API void zend_append_version_info(const zend_extension *extension); -int zend_startup_extensions_mechanism(void); -int zend_startup_extensions(void); +void zend_startup_extensions_mechanism(void); +void zend_startup_extensions(void); void zend_shutdown_extensions(void); BEGIN_EXTERN_C() -ZEND_API int zend_load_extension(const char *path); -ZEND_API int zend_load_extension_handle(DL_HANDLE handle, const char *path); -ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle); +ZEND_API zend_result zend_load_extension(const char *path); +ZEND_API zend_result zend_load_extension_handle(DL_HANDLE handle, const char *path); +ZEND_API void zend_register_extension(zend_extension *new_extension, DL_HANDLE handle); ZEND_API zend_extension *zend_get_extension(const char *extension_name); ZEND_API size_t zend_extensions_op_array_persist_calc(zend_op_array *op_array); ZEND_API size_t zend_extensions_op_array_persist(zend_op_array *op_array, void *mem); diff --git a/Zend/zend_gdb.c b/Zend/zend_gdb.c index 0fff742048..ce6dc6a785 100644 --- a/Zend/zend_gdb.c +++ b/Zend/zend_gdb.c @@ -54,7 +54,7 @@ ZEND_API zend_never_inline void __jit_debug_register_code() __asm__ __volatile__(""); } -ZEND_API int zend_gdb_register_code(const void *object, size_t size) +ZEND_API bool zend_gdb_register_code(const void *object, size_t size) { zend_gdbjit_code_entry *entry; @@ -102,9 +102,9 @@ ZEND_API void zend_gdb_unregister_all(void) } } -ZEND_API int zend_gdb_present(void) +ZEND_API bool zend_gdb_present(void) { - int ret = 0; + bool ret = 0; int fd = open("/proc/self/status", O_RDONLY); if (fd > 0) { diff --git a/Zend/zend_gdb.h b/Zend/zend_gdb.h index 220b70888f..aad0fefb09 100644 --- a/Zend/zend_gdb.h +++ b/Zend/zend_gdb.h @@ -20,8 +20,8 @@ #ifndef ZEND_GDB #define ZEND_GDB -ZEND_API int zend_gdb_register_code(const void *object, size_t size); +ZEND_API bool zend_gdb_register_code(const void *object, size_t size); ZEND_API void zend_gdb_unregister_all(void); -ZEND_API int zend_gdb_present(void); +ZEND_API bool zend_gdb_present(void); #endif diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 040a213ce7..4f35b727ae 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -629,7 +629,7 @@ ZEND_API zend_generator *zend_generator_update_current(zend_generator *generator return root; } -static int zend_generator_get_next_delegated_value(zend_generator *generator) /* {{{ */ +static zend_result zend_generator_get_next_delegated_value(zend_generator *generator) /* {{{ */ { zval *value; if (Z_TYPE(generator->values) == IS_ARRAY) { @@ -1106,6 +1106,7 @@ static const zend_object_iterator_funcs zend_generator_iterator_functions = { zend_generator_iterator_get_gc, }; +/* by_ref is int due to Iterator API */ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */ { zend_object_iterator *iterator; diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 365cf892be..abda03edf6 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -218,7 +218,7 @@ static zend_always_inline void zend_hash_real_init_mixed_ex(HashTable *ht) HT_HASH_RESET(ht); } -static zend_always_inline void zend_hash_real_init_ex(HashTable *ht, int packed) +static zend_always_inline void zend_hash_real_init_ex(HashTable *ht, bool packed) { HT_ASSERT_RC1(ht); ZEND_ASSERT(HT_FLAGS(ht) & HASH_FLAG_UNINITIALIZED); @@ -1360,7 +1360,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_del_bucket(HashTable *ht, Bucket *p) _zend_hash_del_el(ht, HT_IDX_TO_HASH(p - ht->arData), p); } -ZEND_API int ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key) +ZEND_API zend_result ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key) { zend_ulong h; uint32_t nIndex; @@ -1390,7 +1390,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key) return FAILURE; } -ZEND_API int ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key) +ZEND_API zend_result ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key) { zend_ulong h; uint32_t nIndex; @@ -1438,7 +1438,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key) return FAILURE; } -ZEND_API int ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *str, size_t len) +ZEND_API zend_result ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *str, size_t len) { zend_ulong h; uint32_t nIndex; @@ -1482,7 +1482,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *str, return FAILURE; } -ZEND_API int ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, size_t len) +ZEND_API zend_result ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, size_t len) { zend_ulong h; uint32_t nIndex; @@ -1512,7 +1512,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, siz return FAILURE; } -ZEND_API int ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h) +ZEND_API zend_result ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h) { uint32_t nIndex; uint32_t idx; @@ -1964,7 +1964,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_copy(HashTable *target, HashTable *source, } -static zend_always_inline int zend_array_dup_element(HashTable *source, HashTable *target, uint32_t idx, Bucket *p, Bucket *q, int packed, int static_keys, int with_holes) +static zend_always_inline bool zend_array_dup_element(HashTable *source, HashTable *target, uint32_t idx, Bucket *p, Bucket *q, bool packed, bool static_keys, bool with_holes) { zval *data = &p->val; @@ -2018,7 +2018,7 @@ static zend_always_inline int zend_array_dup_element(HashTable *source, HashTabl return 1; } -static zend_always_inline void zend_array_dup_packed_elements(HashTable *source, HashTable *target, int with_holes) +static zend_always_inline void zend_array_dup_packed_elements(HashTable *source, HashTable *target, bool with_holes) { Bucket *p = source->arData; Bucket *q = target->arData; @@ -2034,7 +2034,7 @@ static zend_always_inline void zend_array_dup_packed_elements(HashTable *source, } while (p != end); } -static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, HashTable *target, int static_keys, int with_holes) +static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, HashTable *target, bool static_keys, bool with_holes) { uint32_t idx = 0; Bucket *p = source->arData; @@ -2325,7 +2325,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, Has } -ZEND_API int ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos) +ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos) { uint32_t idx; @@ -2350,7 +2350,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition } } -ZEND_API int ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) +ZEND_API zend_result ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) { uint32_t idx = *pos; @@ -2707,7 +2707,7 @@ ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, bucket_compar return &res->val; } -ZEND_API int ZEND_FASTCALL _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx) +ZEND_API bool ZEND_FASTCALL _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx) { register const char *tmp = key; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index a9684b1dc2..fb11c4a9e3 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -162,11 +162,11 @@ ZEND_API void ZEND_FASTCALL zend_hash_reverse_apply(HashTable *ht, apply_func_t /* Deletes */ -ZEND_API int ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key); -ZEND_API int ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key); -ZEND_API int ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *key, size_t len); -ZEND_API int ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *key, size_t len); -ZEND_API int ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h); +ZEND_API zend_result ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key); +ZEND_API zend_result ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key); +ZEND_API zend_result ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *key, size_t len); +ZEND_API zend_result ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *key, size_t len); +ZEND_API zend_result ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h); ZEND_API void ZEND_FASTCALL zend_hash_del_bucket(HashTable *ht, Bucket *p); /* Data retrieval */ @@ -227,11 +227,11 @@ ZEND_API HashPosition ZEND_FASTCALL zend_hash_get_current_pos(const HashTable *h #define zend_hash_has_more_elements_ex(ht, pos) \ (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS) -ZEND_API int ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); -ZEND_API int ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos); +ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); +ZEND_API zend_result ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); +ZEND_API zend_result ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos); -ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); +ZEND_API zend_result ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos); @@ -305,7 +305,7 @@ ZEND_API void ZEND_FASTCALL zend_symtable_clean(HashTable *ht); ZEND_API HashTable* ZEND_FASTCALL zend_symtable_to_proptable(HashTable *ht); ZEND_API HashTable* ZEND_FASTCALL zend_proptable_to_symtable(HashTable *ht, zend_bool always_duplicate); -ZEND_API int ZEND_FASTCALL _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx); +ZEND_API bool ZEND_FASTCALL _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx); ZEND_API uint32_t ZEND_FASTCALL zend_hash_iterator_add(HashTable *ht, HashPosition pos); ZEND_API HashPosition ZEND_FASTCALL zend_hash_iterator_pos(uint32_t idx, HashTable *ht); @@ -351,7 +351,7 @@ END_EXTERN_C() #define ZEND_INIT_SYMTABLE_EX(ht, n, persistent) \ zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent) -static zend_always_inline int _zend_handle_numeric_str(const char *key, size_t length, zend_ulong *idx) +static zend_always_inline bool _zend_handle_numeric_str(const char *key, size_t length, zend_ulong *idx) { const char *tmp = key; @@ -396,7 +396,7 @@ static zend_always_inline zval *zend_hash_find_ex_ind(const HashTable *ht, zend_ } -static zend_always_inline int zend_hash_exists_ind(const HashTable *ht, zend_string *key) +static zend_always_inline bool zend_hash_exists_ind(const HashTable *ht, zend_string *key) { zval *zv; @@ -416,7 +416,7 @@ static zend_always_inline zval *zend_hash_str_find_ind(const HashTable *ht, cons } -static zend_always_inline int zend_hash_str_exists_ind(const HashTable *ht, const char *str, size_t len) +static zend_always_inline bool zend_hash_str_exists_ind(const HashTable *ht, const char *str, size_t len) { zval *zv; @@ -460,7 +460,7 @@ static zend_always_inline zval *zend_symtable_update_ind(HashTable *ht, zend_str } -static zend_always_inline int zend_symtable_del(HashTable *ht, zend_string *key) +static zend_always_inline zend_result zend_symtable_del(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -472,7 +472,7 @@ static zend_always_inline int zend_symtable_del(HashTable *ht, zend_string *key) } -static zend_always_inline int zend_symtable_del_ind(HashTable *ht, zend_string *key) +static zend_always_inline zend_result zend_symtable_del_ind(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -508,7 +508,7 @@ static zend_always_inline zval *zend_symtable_find_ind(const HashTable *ht, zend } -static zend_always_inline int zend_symtable_exists(HashTable *ht, zend_string *key) +static zend_always_inline bool zend_symtable_exists(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -520,7 +520,7 @@ static zend_always_inline int zend_symtable_exists(HashTable *ht, zend_string *k } -static zend_always_inline int zend_symtable_exists_ind(HashTable *ht, zend_string *key) +static zend_always_inline bool zend_symtable_exists_ind(HashTable *ht, zend_string *key) { zend_ulong idx; @@ -556,7 +556,7 @@ static zend_always_inline zval *zend_symtable_str_update_ind(HashTable *ht, cons } -static zend_always_inline int zend_symtable_str_del(HashTable *ht, const char *str, size_t len) +static zend_always_inline zend_result zend_symtable_str_del(HashTable *ht, const char *str, size_t len) { zend_ulong idx; @@ -568,7 +568,7 @@ static zend_always_inline int zend_symtable_str_del(HashTable *ht, const char *s } -static zend_always_inline int zend_symtable_str_del_ind(HashTable *ht, const char *str, size_t len) +static zend_always_inline zend_result zend_symtable_str_del_ind(HashTable *ht, const char *str, size_t len) { zend_ulong idx; @@ -592,7 +592,7 @@ static zend_always_inline zval *zend_symtable_str_find(HashTable *ht, const char } -static zend_always_inline int zend_symtable_str_exists(HashTable *ht, const char *str, size_t len) +static zend_always_inline bool zend_symtable_str_exists(HashTable *ht, const char *str, size_t len) { zend_ulong idx; @@ -1149,7 +1149,7 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, ZEND_HASH_FILL_FINISH(); \ } while (0) -static zend_always_inline zval *_zend_hash_append_ex(HashTable *ht, zend_string *key, zval *zv, int interned) +static zend_always_inline zval *_zend_hash_append_ex(HashTable *ht, zend_string *key, zval *zv, bool interned) { uint32_t idx = ht->nNumUsed++; uint32_t nIndex; @@ -1175,7 +1175,7 @@ static zend_always_inline zval *_zend_hash_append(HashTable *ht, zend_string *ke return _zend_hash_append_ex(ht, key, zv, 0); } -static zend_always_inline zval *_zend_hash_append_ptr_ex(HashTable *ht, zend_string *key, void *ptr, int interned) +static zend_always_inline zval *_zend_hash_append_ptr_ex(HashTable *ht, zend_string *key, void *ptr, bool interned) { uint32_t idx = ht->nNumUsed++; uint32_t nIndex; diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h index 8ea1518ca6..c4f819d508 100644 --- a/Zend/zend_highlight.h +++ b/Zend/zend_highlight.h @@ -39,8 +39,8 @@ typedef struct _zend_syntax_highlighter_ini { BEGIN_EXTERN_C() ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini); ZEND_API void zend_strip(void); -ZEND_API int highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini); -ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name); +ZEND_API zend_result highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini); +ZEND_API void highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name); ZEND_API void zend_html_putc(char c); ZEND_API void zend_html_puts(const char *s, size_t len); END_EXTERN_C() diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 158b67ce38..4d2e2d5400 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -633,7 +633,7 @@ static inheritance_status zend_do_perform_implementation_check( /* }}} */ static ZEND_COLD void zend_append_type_hint( - smart_str *str, zend_class_entry *scope, zend_arg_info *arg_info, int return_hint) /* {{{ */ + smart_str *str, zend_class_entry *scope, zend_arg_info *arg_info, bool return_hint) /* {{{ */ { if (ZEND_TYPE_IS_SET(arg_info->type)) { zend_string *type_str = zend_type_to_string_resolved(arg_info->type, scope); @@ -2390,7 +2390,7 @@ static void check_unrecoverable_load_failure(zend_class_entry *ce) { } } -ZEND_API int zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name) /* {{{ */ +ZEND_API zend_result zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name) /* {{{ */ { /* Load parent/interface dependencies first, so we can still gracefully abort linking * with an exception and remove the class from the class table. This is only possible diff --git a/Zend/zend_inheritance.h b/Zend/zend_inheritance.h index 6cf2d1b78d..e49ec49b6f 100644 --- a/Zend/zend_inheritance.h +++ b/Zend/zend_inheritance.h @@ -30,7 +30,7 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par #define zend_do_inheritance(ce, parent_ce) \ zend_do_inheritance_ex(ce, parent_ce, 0) -ZEND_API int zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name); +ZEND_API zend_result zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name); void zend_verify_abstract_class(zend_class_entry *ce); void zend_build_properties_info_table(zend_class_entry *ce); diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 488468f0e0..75c7faf4c0 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -41,9 +41,9 @@ static int zend_remove_ini_entries(zval *el, void *arg) /* {{{ */ } /* }}} */ -static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage) /* {{{ */ +static zend_result zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage) /* {{{ */ { - int result = FAILURE; + zend_result result = FAILURE; if (ini_entry->modified) { if (ini_entry->on_modify) { @@ -89,7 +89,7 @@ static void free_ini_entry(zval *zv) /* {{{ */ /* * Startup / shutdown */ -ZEND_API int zend_ini_startup(void) /* {{{ */ +ZEND_API void zend_ini_startup(void) /* {{{ */ { registered_zend_ini_directives = (HashTable *) malloc(sizeof(HashTable)); @@ -97,14 +97,12 @@ ZEND_API int zend_ini_startup(void) /* {{{ */ EG(modified_ini_directives) = NULL; EG(error_reporting_ini_entry) = NULL; zend_hash_init(registered_zend_ini_directives, 128, NULL, free_ini_entry, 1); - return SUCCESS; } /* }}} */ -ZEND_API int zend_ini_shutdown(void) /* {{{ */ +ZEND_API void zend_ini_shutdown(void) /* {{{ */ { zend_ini_dtor(EG(ini_directives)); - return SUCCESS; } /* }}} */ @@ -115,15 +113,14 @@ ZEND_API void zend_ini_dtor(HashTable *ini_directives) /* {{{ */ } /* }}} */ -ZEND_API int zend_ini_global_shutdown(void) /* {{{ */ +ZEND_API void zend_ini_global_shutdown(void) /* {{{ */ { zend_hash_destroy(registered_zend_ini_directives); free(registered_zend_ini_directives); - return SUCCESS; } /* }}} */ -ZEND_API int zend_ini_deactivate(void) /* {{{ */ +ZEND_API void zend_ini_deactivate(void) /* {{{ */ { if (EG(modified_ini_directives)) { zend_ini_entry *ini_entry; @@ -135,7 +132,6 @@ ZEND_API int zend_ini_deactivate(void) /* {{{ */ FREE_HASHTABLE(EG(modified_ini_directives)); EG(modified_ini_directives) = NULL; } - return SUCCESS; } /* }}} */ @@ -159,14 +155,13 @@ static void copy_ini_entry(zval *zv) /* {{{ */ } /* }}} */ -ZEND_API int zend_copy_ini_directives(void) /* {{{ */ +ZEND_API void zend_copy_ini_directives(void) /* {{{ */ { EG(modified_ini_directives) = NULL; EG(error_reporting_ini_entry) = NULL; EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable)); zend_hash_init(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, free_ini_entry, 1); zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, copy_ini_entry); - return SUCCESS; } /* }}} */ #endif @@ -199,7 +194,7 @@ ZEND_API void zend_ini_sort_entries(void) /* {{{ */ /* * Registration / unregistration */ -ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number) /* {{{ */ +ZEND_API zend_result zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number) /* {{{ */ { zend_ini_entry *p; zval *default_value; @@ -280,16 +275,16 @@ ZEND_API void zend_ini_refresh_caches(int stage) /* {{{ */ /* }}} */ #endif -ZEND_API int zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage) /* {{{ */ +ZEND_API zend_result zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage) /* {{{ */ { return zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0); } /* }}} */ -ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage) /* {{{ */ +ZEND_API zend_result zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage) /* {{{ */ { - int ret; + zend_result ret; zend_string *new_value; new_value = zend_string_init(value, value_length, !(stage & ZEND_INI_STAGE_IN_REQUEST)); @@ -299,9 +294,9 @@ ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, si } /* }}} */ -ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change) /* {{{ */ +ZEND_API zend_result zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change) /* {{{ */ { - int ret; + zend_result ret; zend_string *new_value; new_value = zend_string_init(value, value_length, !(stage & ZEND_INI_STAGE_IN_REQUEST)); @@ -311,7 +306,7 @@ ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, } /* }}} */ -ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change) /* {{{ */ +ZEND_API zend_result zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, bool force_change) /* {{{ */ { zend_ini_entry *ini_entry; zend_string *duplicate; @@ -363,7 +358,7 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, } /* }}} */ -ZEND_API int zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */ +ZEND_API zend_result zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */ { zend_ini_entry *ini_entry; @@ -384,7 +379,7 @@ ZEND_API int zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */ } /* }}} */ -ZEND_API int zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ +ZEND_API zend_result zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ { zend_ini_entry *ini_entry; diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index 0289b322be..d227f3779d 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -61,24 +61,24 @@ struct _zend_ini_entry { }; BEGIN_EXTERN_C() -ZEND_API int zend_ini_startup(void); -ZEND_API int zend_ini_shutdown(void); -ZEND_API int zend_ini_global_shutdown(void); -ZEND_API int zend_ini_deactivate(void); +ZEND_API void zend_ini_startup(void); +ZEND_API void zend_ini_shutdown(void); +ZEND_API void zend_ini_global_shutdown(void); +ZEND_API void zend_ini_deactivate(void); ZEND_API void zend_ini_dtor(HashTable *ini_directives); -ZEND_API int zend_copy_ini_directives(void); +ZEND_API void zend_copy_ini_directives(void); ZEND_API void zend_ini_sort_entries(void); -ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number); +ZEND_API zend_result zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number); ZEND_API void zend_unregister_ini_entries(int module_number); ZEND_API void zend_ini_refresh_caches(int stage); -ZEND_API int zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage); -ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change); -ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage); -ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change); -ZEND_API int zend_restore_ini_entry(zend_string *name, int stage); +ZEND_API zend_result zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage); +ZEND_API zend_result zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, bool force_change); +ZEND_API zend_result zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage); +ZEND_API zend_result zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change); +ZEND_API zend_result zend_restore_ini_entry(zend_string *name, int stage); ZEND_API void display_ini_entries(zend_module_entry *module); ZEND_API zend_long zend_ini_long(const char *name, size_t name_length, int orig); @@ -88,7 +88,7 @@ ZEND_API char *zend_ini_string_ex(const char *name, size_t name_length, int orig ZEND_API zend_string *zend_ini_get_value(zend_string *name); ZEND_API zend_bool zend_ini_parse_bool(zend_string *str); -ZEND_API int zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); +ZEND_API zend_result zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb); ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb); diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index 373dee7aeb..f9170d9ecc 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -212,7 +212,7 @@ static ZEND_COLD void ini_error(const char *msg) /* }}} */ /* {{{ zend_parse_ini_file() */ -ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) +ZEND_API zend_result zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) { int retval; zend_ini_parser_param ini_parser_param; @@ -240,7 +240,7 @@ ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_erro /* }}} */ /* {{{ zend_parse_ini_string() */ -ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) +ZEND_API zend_result zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg) { int retval; zend_ini_parser_param ini_parser_param; diff --git a/Zend/zend_ini_scanner.h b/Zend/zend_ini_scanner.h index ddb9247d37..f3d7f1a82b 100644 --- a/Zend/zend_ini_scanner.h +++ b/Zend/zend_ini_scanner.h @@ -28,8 +28,8 @@ BEGIN_EXTERN_C() ZEND_COLD int zend_ini_scanner_get_lineno(void); ZEND_COLD char *zend_ini_scanner_get_filename(void); -int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode); -int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode); +zend_result zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode); +zend_result zend_ini_prepare_string_for_scanning(char *str, int scanner_mode); int ini_lex(zval *ini_lval); void shutdown_ini_scanner(void); END_EXTERN_C() diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index c8efb1f144..1d689f3748 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -151,7 +151,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals; return type; \ } -static inline int convert_to_number(zval *retval, const char *str, const int str_len) +static inline zend_result convert_to_number(zval *retval, const char *str, const int str_len) { zend_uchar type; int overflow; @@ -218,7 +218,7 @@ static void yy_scan_buffer(char *str, unsigned int len) #define ini_filename SCNG(filename) /* {{{ init_ini_scanner() */ -static int init_ini_scanner(int scanner_mode, zend_file_handle *fh) +static zend_result init_ini_scanner(int scanner_mode, zend_file_handle *fh) { /* Sanity check */ if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW && scanner_mode != ZEND_INI_SCANNER_TYPED) { @@ -268,7 +268,7 @@ ZEND_COLD char *zend_ini_scanner_get_filename(void) /* }}} */ /* {{{ zend_ini_open_file_for_scanning() */ -int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode) +zend_result zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode) { char *buf; size_t size; @@ -289,7 +289,7 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode) /* }}} */ /* {{{ zend_ini_prepare_string_for_scanning() */ -int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode) +zend_result zend_ini_prepare_string_for_scanning(char *str, int scanner_mode) { int len = (int)strlen(str); diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 808de7c170..1278f08209 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -124,7 +124,7 @@ ZEND_API int zend_user_it_valid(zend_object_iterator *_iter) zend_user_iterator *iter = (zend_user_iterator*)_iter; zval *object = &iter->it.data; zval more; - int result; + bool result; zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_valid, "valid", &more); result = i_zend_is_true(&more); @@ -203,6 +203,7 @@ static const zend_object_iterator_funcs zend_interface_iterator_funcs_iterator = }; /* {{{ zend_user_it_get_iterator */ +/* by_ref is int due to Iterator API */ static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zval *object, int by_ref) { zend_user_iterator *iterator; @@ -225,6 +226,7 @@ static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zva /* }}} */ /* {{{ zend_user_it_get_new_iterator */ +/* by_ref is int due to Iterator API */ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce, zval *object, int by_ref) { zval iterator; @@ -356,7 +358,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *b { zend_class_entry * ce = Z_OBJCE_P(object); zval retval; - int result; + zend_result result; zend_call_method_with_0_params( Z_OBJ_P(object), Z_OBJCE_P(object), NULL, "serialize", &retval); @@ -458,7 +460,7 @@ static zend_object *zend_internal_iterator_create(zend_class_entry *ce) { return &intern->std; } -ZEND_API int zend_create_internal_iterator_zval(zval *return_value, zval *obj) { +ZEND_API zend_result zend_create_internal_iterator_zval(zval *return_value, zval *obj) { zend_class_entry *scope = EG(current_execute_data)->func->common.scope; ZEND_ASSERT(scope->get_iterator != zend_user_it_get_new_iterator); zend_object_iterator *iter = scope->get_iterator(Z_OBJCE_P(obj), obj, /* by_ref */ 0); @@ -492,7 +494,7 @@ static zend_internal_iterator *zend_internal_iterator_fetch(zval *This) { } /* Many iterators will not behave correctly if rewind() is not called, make sure it happens. */ -static int zend_internal_iterator_ensure_rewound(zend_internal_iterator *intern) { +static zend_result zend_internal_iterator_ensure_rewound(zend_internal_iterator *intern) { if (!intern->rewind_called) { zend_object_iterator *iter = intern->iter; intern->rewind_called = 1; diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index 3f3f39b087..ecdc9b0e1b 100644 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -61,7 +61,7 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z zend_class_implements(zend_ce_ ## class_name, 1, zend_ce_ ## interface_name) ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter); -ZEND_API int zend_user_it_valid(zend_object_iterator *_iter); +ZEND_API zend_result zend_user_it_valid(zend_object_iterator *_iter); ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *key); ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter); ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter); @@ -78,7 +78,7 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data); -ZEND_API int zend_create_internal_iterator_zval(zval *return_value, zval *obj); +ZEND_API zend_result zend_create_internal_iterator_zval(zval *return_value, zval *obj); END_EXTERN_C() diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h index c15f11af2e..f08dbb4ea9 100644 --- a/Zend/zend_language_scanner.h +++ b/Zend/zend_language_scanner.h @@ -75,10 +75,10 @@ typedef struct _zend_nest_location { BEGIN_EXTERN_C() ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state); ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state); -ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename); +ZEND_API void zend_prepare_string_for_scanning(zval *str, const char *filename); ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding); -ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding); -ZEND_API int zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref); +ZEND_API zend_result zend_multibyte_set_filter(const zend_encoding *onetime_encoding); +ZEND_API zend_result zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref); END_EXTERN_C() diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index d16df9dbec..ee88282fd5 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -306,7 +306,7 @@ ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle) } } -ZEND_API int zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref) +ZEND_API zend_result zend_lex_tstring(zval *zv, zend_lexer_ident_ref ident_ref) { char *ident = (char *) SCNG(yy_start) + ident_ref.offset; size_t length = ident_ref.len; @@ -486,7 +486,7 @@ static const zend_encoding* zend_multibyte_find_script_encoding(void) return CG(script_encoding_list)[0]; } -ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding) +ZEND_API zend_result zend_multibyte_set_filter(const zend_encoding *onetime_encoding) { const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(); const zend_encoding *script_encoding = onetime_encoding ? onetime_encoding: zend_multibyte_find_script_encoding(); @@ -524,10 +524,10 @@ ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding) LANG_SCNG(output_filter) = encoding_filter_intermediate_to_internal; } - return 0; + return SUCCESS; } -ZEND_API int open_file_for_scanning(zend_file_handle *file_handle) +ZEND_API zend_result open_file_for_scanning(zend_file_handle *file_handle) { char *buf; size_t size; @@ -680,16 +680,15 @@ ZEND_API zend_ast *zend_compile_string_to_ast( CG(in_compilation) = 1; zend_save_lexical_state(&original_lex_state); - if (zend_prepare_string_for_scanning(&code_zv, filename) == SUCCESS) { - CG(ast) = NULL; - CG(ast_arena) = zend_arena_create(1024 * 32); - LANG_SCNG(yy_state) = yycINITIAL; + zend_prepare_string_for_scanning(&code_zv, filename); + CG(ast) = NULL; + CG(ast_arena) = zend_arena_create(1024 * 32); + LANG_SCNG(yy_state) = yycINITIAL; - if (zendparse() != 0) { - zend_ast_destroy(CG(ast)); - zend_arena_destroy(CG(ast_arena)); - CG(ast) = NULL; - } + if (zendparse() != 0) { + zend_ast_destroy(CG(ast)); + zend_arena_destroy(CG(ast_arena)); + CG(ast) = NULL; } /* restore_lexical_state changes CG(ast) and CG(ast_arena) */ @@ -737,7 +736,7 @@ zend_op_array *compile_filename(int type, zval *filename) return retval; } -ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename) +ZEND_API void zend_prepare_string_for_scanning(zval *str, const char *filename) { char *buf; size_t size, old_len; @@ -780,7 +779,6 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename) CG(zend_lineno) = 1; CG(increment_lineno) = 0; RESET_DOC_COMMENT(); - return SUCCESS; } @@ -823,10 +821,9 @@ zend_op_array *compile_string(zval *source_string, const char *filename) } zend_save_lexical_state(&original_lex_state); - if (zend_prepare_string_for_scanning(&tmp, filename) == SUCCESS) { - BEGIN(ST_IN_SCRIPTING); - op_array = zend_compile(ZEND_EVAL_CODE); - } + zend_prepare_string_for_scanning(&tmp, filename); + BEGIN(ST_IN_SCRIPTING); + op_array = zend_compile(ZEND_EVAL_CODE); zend_restore_lexical_state(&original_lex_state); zval_ptr_dtor(&tmp); @@ -836,7 +833,7 @@ zend_op_array *compile_string(zval *source_string, const char *filename) BEGIN_EXTERN_C() -int highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini) +zend_result highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini) { zend_lex_state original_lex_state; zend_file_handle file_handle; @@ -858,7 +855,7 @@ int highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_hig return SUCCESS; } -int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name) +void highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name) { zend_lex_state original_lex_state; zval tmp; @@ -868,13 +865,7 @@ int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ str = &tmp; } zend_save_lexical_state(&original_lex_state); - if (zend_prepare_string_for_scanning(str, str_name)==FAILURE) { - zend_restore_lexical_state(&original_lex_state); - if (UNEXPECTED(str == &tmp)) { - zval_ptr_dtor(&tmp); - } - return FAILURE; - } + zend_prepare_string_for_scanning(str, str_name); BEGIN(INITIAL); zend_highlight(syntax_highlighter_ini); if (SCNG(script_filtered)) { @@ -885,7 +876,6 @@ int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ if (UNEXPECTED(str == &tmp)) { zval_ptr_dtor(&tmp); } - return SUCCESS; } ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding) @@ -937,7 +927,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter ZVAL_STRINGL(zendlval, yytext, yyleng); \ } -static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type) +static zend_result zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type) { register char *s, *t; char *end; @@ -1290,11 +1280,11 @@ static void enter_nesting(char opening) zend_stack_push(&SCNG(nest_location_stack), &nest_loc); } -static int exit_nesting(char closing) +static zend_result exit_nesting(char closing) { if (zend_stack_is_empty(&SCNG(nest_location_stack))) { zend_throw_exception_ex(zend_ce_parse_error, 0, "Unmatched '%c'", closing); - return -1; + return FAILURE; } zend_nest_location *nest_loc = zend_stack_top(&SCNG(nest_location_stack)); @@ -1304,22 +1294,22 @@ static int exit_nesting(char closing) (opening == '[' && closing != ']') || (opening == '(' && closing != ')')) { report_bad_nesting(opening, nest_loc->lineno, closing); - return -1; + return FAILURE; } zend_stack_del_top(&SCNG(nest_location_stack)); - return 0; + return SUCCESS; } -static int check_nesting_at_end() +static zend_result check_nesting_at_end() { if (!zend_stack_is_empty(&SCNG(nest_location_stack))) { zend_nest_location *nest_loc = zend_stack_top(&SCNG(nest_location_stack)); report_bad_nesting(nest_loc->text, nest_loc->lineno, 0); - return -1; + return FAILURE; } - return 0; + return SUCCESS; } #define PARSER_MODE() \ diff --git a/Zend/zend_list.c b/Zend/zend_list.c index fd3db65395..45ff950b6b 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -42,7 +42,7 @@ ZEND_API zval* ZEND_FASTCALL zend_list_insert(void *ptr, int type) return zend_hash_index_add_new(&EG(regular_list), index, &zv); } -ZEND_API int ZEND_FASTCALL zend_list_delete(zend_resource *res) +ZEND_API zend_result ZEND_FASTCALL zend_list_delete(zend_resource *res) { if (GC_DELREF(res) <= 0) { return zend_hash_index_del(&EG(regular_list), res->handle); @@ -76,14 +76,13 @@ static void zend_resource_dtor(zend_resource *res) } -ZEND_API int ZEND_FASTCALL zend_list_close(zend_resource *res) +ZEND_API void ZEND_FASTCALL zend_list_close(zend_resource *res) { if (GC_REFCOUNT(res) <= 0) { zend_list_free(res); } else if (res->type >= 0) { zend_resource_dtor(res); } - return SUCCESS; } ZEND_API zend_resource* zend_register_resource(void *rsrc_pointer, int rsrc_type) @@ -203,18 +202,16 @@ void plist_entry_destructor(zval *zv) free(res); } -ZEND_API int zend_init_rsrc_list(void) +ZEND_API void zend_init_rsrc_list(void) { zend_hash_init(&EG(regular_list), 8, NULL, list_entry_destructor, 0); EG(regular_list).nNextFreeElement = 0; - return SUCCESS; } -int zend_init_rsrc_plist(void) +void zend_init_rsrc_plist(void) { zend_hash_init(&EG(persistent_list), 8, NULL, plist_entry_destructor, 1); - return SUCCESS; } @@ -235,6 +232,7 @@ void zend_destroy_rsrc_list(HashTable *ht) zend_hash_graceful_reverse_destroy(ht); } +/* int return due to HashTable API */ static int clean_module_resource(zval *zv, void *arg) { int resource_id = *(int *)arg; @@ -242,7 +240,7 @@ static int clean_module_resource(zval *zv, void *arg) return Z_RES_TYPE_P(zv) == resource_id; } - +/* int return due to HashTable API */ static int zend_clean_module_rsrc_dtors_cb(zval *zv, void *arg) { zend_rsrc_list_dtors_entry *ld = (zend_rsrc_list_dtors_entry *)Z_PTR_P(zv); @@ -299,11 +297,10 @@ static void list_destructors_dtor(zval *zv) free(Z_PTR_P(zv)); } -int zend_init_rsrc_list_dtors(void) +void zend_init_rsrc_list_dtors(void) { zend_hash_init(&list_destructors, 64, NULL, list_destructors_dtor, 1); list_destructors.nNextFreeElement=1; /* we don't want resource type 0 */ - return SUCCESS; } diff --git a/Zend/zend_list.h b/Zend/zend_list.h index 92fdd3d417..680915121e 100644 --- a/Zend/zend_list.h +++ b/Zend/zend_list.h @@ -45,17 +45,17 @@ void list_entry_destructor(zval *ptr); void plist_entry_destructor(zval *ptr); void zend_clean_module_rsrc_dtors(int module_number); -ZEND_API int zend_init_rsrc_list(void); /* Exported for phar hack */ -int zend_init_rsrc_plist(void); +ZEND_API void zend_init_rsrc_list(void); /* Exported for phar hack */ +void zend_init_rsrc_plist(void); void zend_close_rsrc_list(HashTable *ht); void zend_destroy_rsrc_list(HashTable *ht); -int zend_init_rsrc_list_dtors(void); +void zend_init_rsrc_list_dtors(void); void zend_destroy_rsrc_list_dtors(void); ZEND_API zval* ZEND_FASTCALL zend_list_insert(void *ptr, int type); ZEND_API void ZEND_FASTCALL zend_list_free(zend_resource *res); ZEND_API int ZEND_FASTCALL zend_list_delete(zend_resource *res); -ZEND_API int ZEND_FASTCALL zend_list_close(zend_resource *res); +ZEND_API void ZEND_FASTCALL zend_list_close(zend_resource *res); ZEND_API zend_resource *zend_register_resource(void *rsrc_pointer, int rsrc_type); ZEND_API void *zend_fetch_resource(zend_resource *res, const char *resource_type_name, int resource_type); diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index c7e279a408..cb64324d38 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -77,10 +77,10 @@ struct _zend_module_entry { const struct _zend_module_dep *deps; const char *name; const struct _zend_function_entry *functions; - int (*module_startup_func)(INIT_FUNC_ARGS); - int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); - int (*request_startup_func)(INIT_FUNC_ARGS); - int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); + zend_result (*module_startup_func)(INIT_FUNC_ARGS); + zend_result (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); + zend_result (*request_startup_func)(INIT_FUNC_ARGS); + zend_result (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS); const char *version; size_t globals_size; diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c index 956ffbb74f..f8dab66875 100644 --- a/Zend/zend_multibyte.c +++ b/Zend/zend_multibyte.c @@ -33,7 +33,7 @@ static const char *dummy_encoding_name_getter(const zend_encoding *encoding) return (const char*)encoding; } -static int dummy_encoding_lexer_compatibility_checker(const zend_encoding *encoding) +static bool dummy_encoding_lexer_compatibility_checker(const zend_encoding *encoding) { return 0; } @@ -48,7 +48,7 @@ static size_t dummy_encoding_converter(unsigned char **to, size_t *to_length, co return (size_t)-1; } -static int dummy_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent) +static zend_result dummy_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) { *return_list = pemalloc(0, persistent); *return_size = 0; @@ -60,7 +60,7 @@ static const zend_encoding *dummy_internal_encoding_getter(void) return NULL; } -static int dummy_internal_encoding_setter(const zend_encoding *encoding) +static zend_result dummy_internal_encoding_setter(const zend_encoding *encoding) { return FAILURE; } @@ -84,7 +84,7 @@ ZEND_API const zend_encoding *zend_multibyte_encoding_utf16be = (const zend_enco ZEND_API const zend_encoding *zend_multibyte_encoding_utf16le = (const zend_encoding*)"UTF-32LE"; ZEND_API const zend_encoding *zend_multibyte_encoding_utf8 = (const zend_encoding*)"UTF-8"; -ZEND_API int zend_multibyte_set_functions(const zend_multibyte_functions *functions) +ZEND_API zend_result zend_multibyte_set_functions(const zend_multibyte_functions *functions) { zend_multibyte_encoding_utf32be = functions->encoding_fetcher("UTF-32BE"); if (!zend_multibyte_encoding_utf32be) { @@ -155,7 +155,7 @@ ZEND_API size_t zend_multibyte_encoding_converter(unsigned char **to, size_t *to return multibyte_functions.encoding_converter(to, to_length, from, from_length, encoding_to, encoding_from); } -ZEND_API int zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent) +ZEND_API zend_result zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) { return multibyte_functions.encoding_list_parser(encoding_list, encoding_list_len, return_list, return_size, persistent); } @@ -180,12 +180,12 @@ ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_l return SUCCESS; } -ZEND_API int zend_multibyte_set_internal_encoding(const zend_encoding *encoding) +ZEND_API zend_result zend_multibyte_set_internal_encoding(const zend_encoding *encoding) { return multibyte_functions.internal_encoding_setter(encoding); } -ZEND_API int zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length) +ZEND_API zend_result zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length) { const zend_encoding **list = 0; size_t size = 0; diff --git a/Zend/zend_multibyte.h b/Zend/zend_multibyte.h index 19444eda83..5466840cd9 100644 --- a/Zend/zend_multibyte.h +++ b/Zend/zend_multibyte.h @@ -26,12 +26,12 @@ typedef size_t (*zend_encoding_filter)(unsigned char **str, size_t *str_length, typedef const zend_encoding* (*zend_encoding_fetcher)(const char *encoding_name); typedef const char* (*zend_encoding_name_getter)(const zend_encoding *encoding); -typedef int (*zend_encoding_lexer_compatibility_checker)(const zend_encoding *encoding); +typedef bool (*zend_encoding_lexer_compatibility_checker)(const zend_encoding *encoding); typedef const zend_encoding *(*zend_encoding_detector)(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size); typedef size_t (*zend_encoding_converter)(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from); -typedef int (*zend_encoding_list_parser)(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent); +typedef zend_result (*zend_encoding_list_parser)(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent); typedef const zend_encoding *(*zend_encoding_internal_encoding_getter)(void); -typedef int (*zend_encoding_internal_encoding_setter)(const zend_encoding *encoding); +typedef zend_result (*zend_encoding_internal_encoding_setter)(const zend_encoding *encoding); typedef struct _zend_multibyte_functions { const char *provider_name; @@ -57,7 +57,7 @@ ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf16le; ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf8; /* multibyte utility functions */ -ZEND_API int zend_multibyte_set_functions(const zend_multibyte_functions *functions); +ZEND_API zend_result zend_multibyte_set_functions(const zend_multibyte_functions *functions); ZEND_API void zend_multibyte_restore_functions(void); ZEND_API const zend_multibyte_functions *zend_multibyte_get_functions(void); @@ -66,13 +66,13 @@ ZEND_API const char *zend_multibyte_get_encoding_name(const zend_encoding *encod ZEND_API int zend_multibyte_check_lexer_compatibility(const zend_encoding *encoding); ZEND_API const zend_encoding *zend_multibyte_encoding_detector(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size); ZEND_API size_t zend_multibyte_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from); -ZEND_API int zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent); +ZEND_API int zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent); ZEND_API const zend_encoding *zend_multibyte_get_internal_encoding(void); ZEND_API const zend_encoding *zend_multibyte_get_script_encoding(void); ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size); ZEND_API int zend_multibyte_set_internal_encoding(const zend_encoding *encoding); -ZEND_API int zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length); +ZEND_API zend_result zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length); END_EXTERN_C() diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h index a3827d25d1..c6cd472a23 100644 --- a/Zend/zend_multiply.h +++ b/Zend/zend_multiply.h @@ -154,7 +154,7 @@ #if defined(__GNUC__) && (defined(__native_client__) || defined(i386)) -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res = nmemb; size_t m_overflow = 0; @@ -182,7 +182,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #elif defined(__GNUC__) && defined(__x86_64__) -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res = nmemb; zend_ulong m_overflow = 0; @@ -219,7 +219,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #elif defined(__GNUC__) && defined(__arm__) -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res; zend_ulong m_overflow; @@ -241,7 +241,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #elif defined(__GNUC__) && defined(__aarch64__) -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res; zend_ulong m_overflow; @@ -262,7 +262,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #elif defined(__GNUC__) && defined(__powerpc64__) -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res; unsigned long m_overflow; @@ -286,7 +286,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #elif SIZEOF_SIZE_T == 4 -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { uint64_t res = (uint64_t) nmemb * (uint64_t) size + (uint64_t) offset; @@ -300,7 +300,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si #else -static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) +static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow) { size_t res = nmemb * size + offset; double _d = (double)nmemb * (double)size + (double)offset; @@ -317,7 +317,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si static zend_always_inline size_t zend_safe_address_guarded(size_t nmemb, size_t size, size_t offset) { - int overflow; + bool overflow; size_t ret = zend_safe_address(nmemb, size, offset, &overflow); if (UNEXPECTED(overflow)) { @@ -330,7 +330,7 @@ static zend_always_inline size_t zend_safe_address_guarded(size_t nmemb, size_t /* A bit more generic version of the same */ static zend_always_inline size_t zend_safe_addmult(size_t nmemb, size_t size, size_t offset, const char *message) { - int overflow; + bool overflow; size_t ret = zend_safe_address(nmemb, size, offset, &overflow); if (UNEXPECTED(overflow)) { diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 14dd6e46db..a9236faf6a 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -907,12 +907,12 @@ ZEND_API void zend_recalc_live_ranges( zend_calc_live_ranges(op_array, needs_live_range); } -ZEND_API int pass_two(zend_op_array *op_array) +ZEND_API void pass_two(zend_op_array *op_array) { zend_op *opline, *end; if (!ZEND_USER_CODE(op_array->type)) { - return 0; + return; } if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_STMT) { zend_update_extended_stmts(op_array); @@ -1074,7 +1074,7 @@ ZEND_API int pass_two(zend_op_array *op_array) zend_calc_live_ranges(op_array, NULL); - return 0; + return; } ZEND_API unary_op_type get_unary_op(int opcode) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index fba6c6337a..7de4cd8ad7 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -232,7 +232,7 @@ static zend_never_inline zval* ZEND_FASTCALL _zendi_convert_scalar_to_number_sil } /* }}} */ -static zend_never_inline int ZEND_FASTCALL _zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ +static zend_never_inline zend_result ZEND_FASTCALL _zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ { switch (Z_TYPE_P(op)) { case IS_NULL: @@ -274,7 +274,7 @@ static zend_never_inline int ZEND_FASTCALL _zendi_try_convert_scalar_to_number(z } /* }}} */ -static zend_always_inline int zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ +static zend_always_inline zend_result zendi_try_convert_scalar_to_number(zval *op, zval *holder) /* {{{ */ { if (Z_TYPE_P(op) == IS_LONG || Z_TYPE_P(op) == IS_DOUBLE) { ZVAL_COPY_VALUE(holder, op); @@ -559,7 +559,7 @@ ZEND_API void ZEND_FASTCALL convert_to_null(zval *op) /* {{{ */ ZEND_API void ZEND_FASTCALL convert_to_boolean(zval *op) /* {{{ */ { - int tmp; + bool tmp; try_again: switch (Z_TYPE_P(op)) { @@ -963,7 +963,7 @@ static zend_never_inline void ZEND_FASTCALL add_function_array(zval *result, zva } /* }}} */ -static zend_always_inline int add_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_always_inline zend_result add_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -987,7 +987,7 @@ static zend_always_inline int add_function_fast(zval *result, zval *op1, zval *o } } /* }}} */ -static zend_never_inline int ZEND_FASTCALL add_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_never_inline zend_result ZEND_FASTCALL add_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1019,7 +1019,7 @@ static zend_never_inline int ZEND_FASTCALL add_function_slow(zval *result, zval return FAILURE; } /* }}} */ -ZEND_API int ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* {{{ */ { if (add_function_fast(result, op1, op2) == SUCCESS) { return SUCCESS; @@ -1029,7 +1029,7 @@ ZEND_API int ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* { } /* }}} */ -static zend_always_inline int sub_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_always_inline zend_result sub_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1051,7 +1051,7 @@ static zend_always_inline int sub_function_fast(zval *result, zval *op1, zval *o } /* }}} */ -static zend_never_inline int ZEND_FASTCALL sub_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_never_inline zend_result ZEND_FASTCALL sub_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1084,7 +1084,7 @@ static zend_never_inline int ZEND_FASTCALL sub_function_slow(zval *result, zval } /* }}} */ -ZEND_API int ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* {{{ */ { if (sub_function_fast(result, op1, op2) == SUCCESS) { return SUCCESS; @@ -1094,7 +1094,7 @@ ZEND_API int ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* { } /* }}} */ -static zend_always_inline int mul_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_always_inline zend_result mul_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1120,7 +1120,7 @@ static zend_always_inline int mul_function_fast(zval *result, zval *op1, zval *o } /* }}} */ -static zend_never_inline int ZEND_FASTCALL mul_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_never_inline zend_result ZEND_FASTCALL mul_function_slow(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1153,7 +1153,7 @@ static zend_never_inline int ZEND_FASTCALL mul_function_slow(zval *result, zval } /* }}} */ -ZEND_API int ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* {{{ */ { if (mul_function_fast(result, op1, op2) == SUCCESS) { return SUCCESS; @@ -1163,7 +1163,7 @@ ZEND_API int ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* { } /* }}} */ -static int ZEND_FASTCALL pow_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_result ZEND_FASTCALL pow_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1220,7 +1220,7 @@ static int ZEND_FASTCALL pow_function_base(zval *result, zval *op1, zval *op2) / } /* }}} */ -ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1256,7 +1256,7 @@ ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* { #ifdef __clang__ __attribute__((no_sanitize("float-divide-by-zero"))) #endif -static int ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_result ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); @@ -1300,7 +1300,7 @@ static int ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) / } /* }}} */ -ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_DEREF(op1); ZVAL_DEREF(op2); @@ -1333,7 +1333,7 @@ ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* { } /* }}} */ -ZEND_API int ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1367,7 +1367,7 @@ ZEND_API int ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* { } /* }}} */ -ZEND_API int ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ { int op1_val, op2_val; @@ -1417,7 +1417,7 @@ ZEND_API int ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *o } /* }}} */ -ZEND_API int ZEND_FASTCALL boolean_not_function(zval *result, zval *op1) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL boolean_not_function(zval *result, zval *op1) /* {{{ */ { if (Z_TYPE_P(op1) < IS_TRUE) { ZVAL_TRUE(result); @@ -1442,7 +1442,7 @@ ZEND_API int ZEND_FASTCALL boolean_not_function(zval *result, zval *op1) /* {{{ } /* }}} */ -ZEND_API int ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1) /* {{{ */ { try_again: switch (Z_TYPE_P(op1)) { @@ -1482,7 +1482,7 @@ try_again: } /* }}} */ -ZEND_API int ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1564,7 +1564,7 @@ ZEND_API int ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op } /* }}} */ -ZEND_API int ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1646,7 +1646,7 @@ ZEND_API int ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *o } /* }}} */ -ZEND_API int ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1728,7 +1728,7 @@ ZEND_API int ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *o } /* }}} */ -ZEND_API int ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1765,7 +1765,7 @@ ZEND_API int ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op } /* }}} */ -ZEND_API int ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long op1_lval, op2_lval; @@ -1801,7 +1801,7 @@ ZEND_API int ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *o } /* }}} */ -ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zval *orig_op1 = op1; zval op1_copy, op2_copy; @@ -1992,7 +1992,7 @@ ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2) /* {{{ } /* }}} */ -ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_LONG(result, zend_compare(op1, op2)); return SUCCESS; @@ -2175,6 +2175,7 @@ ZEND_API int ZEND_FASTCALL zend_compare(zval *op1, zval *op2) /* {{{ */ } /* }}} */ +/* return int to be compatible with compare_func_t */ static int hash_zval_identical_function(zval *z1, zval *z2) /* {{{ */ { /* is_identical_function() returns 1 in case of identity and 0 in case @@ -2217,42 +2218,42 @@ ZEND_API zend_bool ZEND_FASTCALL zend_is_identical(zval *op1, zval *op2) /* {{{ } /* }}} */ -ZEND_API int ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, zend_is_identical(op1, op2)); return SUCCESS; } /* }}} */ -ZEND_API int ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, !zend_is_identical(op1, op2)); return SUCCESS; } /* }}} */ -ZEND_API int ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, zend_compare(op1, op2) == 0); return SUCCESS; } /* }}} */ -ZEND_API int ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, (zend_compare(op1, op2) != 0)); return SUCCESS; } /* }}} */ -ZEND_API int ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, (zend_compare(op1, op2) < 0)); return SUCCESS; } /* }}} */ -ZEND_API int ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ { ZVAL_BOOL(result, (zend_compare(op1, op2) <= 0)); return SUCCESS; @@ -2395,7 +2396,7 @@ static void ZEND_FASTCALL increment_string(zval *str) /* {{{ */ } /* }}} */ -ZEND_API int ZEND_FASTCALL increment_function(zval *op1) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL increment_function(zval *op1) /* {{{ */ { try_again: switch (Z_TYPE_P(op1)) { @@ -2460,7 +2461,7 @@ try_again: } /* }}} */ -ZEND_API int ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */ +ZEND_API zend_result ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */ { zend_long lval; double dval; @@ -2525,11 +2526,11 @@ try_again: ZEND_API int ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */ { - return i_zend_is_true(op); + return (int) i_zend_is_true(op); } /* }}} */ -ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ { zend_object *zobj = Z_OBJ_P(op); zval tmp; @@ -2537,7 +2538,7 @@ ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ return Z_TYPE(tmp) == IS_TRUE; } zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to bool", ZSTR_VAL(zobj->ce->name)); - return 1; + return false; } /* }}} */ @@ -2621,7 +2622,7 @@ ZEND_API char* ZEND_FASTCALL zend_str_tolower_dup_ex(const char *source, size_t } /* }}} */ -ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, int persistent) /* {{{ */ +ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, bool persistent) /* {{{ */ { size_t length = ZSTR_LEN(str); unsigned char *p = (unsigned char *) ZSTR_VAL(str); @@ -2817,9 +2818,9 @@ ZEND_API int ZEND_FASTCALL zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval } /* }}} */ -ZEND_API int ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2) /* {{{ */ +ZEND_API bool ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2) /* {{{ */ { - int ret1, ret2; + zend_uchar ret1, ret2; int oflow1, oflow2; zend_long lval1 = 0, lval2 = 0; double dval1 = 0.0, dval2 = 0.0; @@ -2867,7 +2868,7 @@ string_cmp: ZEND_API int ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2) /* {{{ */ { - int ret1, ret2; + zend_uchar ret1, ret2; int oflow1, oflow2; zend_long lval1 = 0, lval2 = 0; double dval1 = 0.0, dval2 = 0.0; diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 9eb064b125..d543b7b03c 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -38,30 +38,30 @@ #define LONG_SIGN_MASK ZEND_LONG_MIN BEGIN_EXTERN_C() -ZEND_API int ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL boolean_not_function(zval *result, zval *op1); -ZEND_API int ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1); -ZEND_API int ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL boolean_not_function(zval *result, zval *op1); +ZEND_API zend_result ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1); +ZEND_API zend_result ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2); ZEND_API zend_bool ZEND_FASTCALL zend_is_identical(zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2); -ZEND_API int ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2); +ZEND_API zend_result ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2); ZEND_API zend_bool ZEND_FASTCALL zend_class_implements_interface(const zend_class_entry *class_ce, const zend_class_entry *interface_ce); ZEND_API zend_bool ZEND_FASTCALL instanceof_function_slow(const zend_class_entry *instance_ce, const zend_class_entry *ce); @@ -255,8 +255,8 @@ zend_memnrstr(const char *haystack, const char *needle, size_t needle_len, const } } -ZEND_API int ZEND_FASTCALL increment_function(zval *op1); -ZEND_API int ZEND_FASTCALL decrement_function(zval *op2); +ZEND_API zend_result ZEND_FASTCALL increment_function(zval *op1); +ZEND_API zend_result ZEND_FASTCALL decrement_function(zval *op2); ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op); ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op); @@ -342,14 +342,14 @@ static zend_always_inline zend_bool try_convert_to_string(zval *op) { ZEND_API int ZEND_FASTCALL zend_is_true(zval *op); -ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op); +ZEND_API bool ZEND_FASTCALL zend_object_is_true(zval *op); #define zval_is_true(op) \ zend_is_true(op) -static zend_always_inline int i_zend_is_true(zval *op) +static zend_always_inline bool i_zend_is_true(zval *op) { - int result = 0; + bool result = 0; again: switch (Z_TYPE_P(op)) { @@ -418,7 +418,7 @@ ZEND_API void ZEND_FASTCALL zend_str_tolower(char *str, size_t length); ZEND_API char* ZEND_FASTCALL zend_str_tolower_copy(char *dest, const char *source, size_t length); ZEND_API char* ZEND_FASTCALL zend_str_tolower_dup(const char *source, size_t length); ZEND_API char* ZEND_FASTCALL zend_str_tolower_dup_ex(const char *source, size_t length); -ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, int persistent); +ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, bool persistent); #define zend_string_tolower(str) zend_string_tolower_ex(str, 0) @@ -433,7 +433,7 @@ ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp(const char *s1, size_t len1, ZEND_API int ZEND_FASTCALL zend_binary_strcasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2); ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2, size_t length); -ZEND_API int ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2); +ZEND_API bool ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2); ZEND_API int ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2); ZEND_API int ZEND_FASTCALL zend_compare_symbol_tables(HashTable *ht1, HashTable *ht2); ZEND_API int ZEND_FASTCALL zend_compare_arrays(zval *a1, zval *a2); @@ -738,7 +738,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL #endif } -static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *op2) +static zend_always_inline zend_result fast_add_function(zval *result, zval *op1, zval *op2) { if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { @@ -842,12 +842,12 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL #endif } -static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *op2) +static zend_always_inline zend_result fast_div_function(zval *result, zval *op1, zval *op2) { return div_function(result, op1, op2); } -static zend_always_inline int zend_fast_equal_strings(zend_string *s1, zend_string *s2) +static zend_always_inline bool zend_fast_equal_strings(zend_string *s1, zend_string *s2) { if (s1 == s2) { return 1; @@ -858,7 +858,7 @@ static zend_always_inline int zend_fast_equal_strings(zend_string *s1, zend_stri } } -static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2) +static zend_always_inline bool fast_equal_check_function(zval *op1, zval *op2) { if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { @@ -880,7 +880,7 @@ static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2) return zend_compare(op1, op2) == 0; } -static zend_always_inline int fast_equal_check_long(zval *op1, zval *op2) +static zend_always_inline bool fast_equal_check_long(zval *op1, zval *op2) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { return Z_LVAL_P(op1) == Z_LVAL_P(op2); @@ -888,7 +888,7 @@ static zend_always_inline int fast_equal_check_long(zval *op1, zval *op2) return zend_compare(op1, op2) == 0; } -static zend_always_inline int fast_equal_check_string(zval *op1, zval *op2) +static zend_always_inline bool fast_equal_check_string(zval *op1, zval *op2) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { return zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); diff --git a/Zend/zend_signal.c b/Zend/zend_signal.c index 2086f03dd8..80feecd98f 100644 --- a/Zend/zend_signal.c +++ b/Zend/zend_signal.c @@ -223,7 +223,7 @@ static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context) /* {{{ zend_sigaction * Register a signal handler that will be deferred in critical sections */ -ZEND_API int zend_sigaction(int signo, const struct sigaction *act, struct sigaction *oldact) +ZEND_API void zend_sigaction(int signo, const struct sigaction *act, struct sigaction *oldact) { struct sigaction sa; sigset_t sigset; @@ -259,14 +259,12 @@ ZEND_API int zend_sigaction(int signo, const struct sigaction *act, struct sigac sigaddset(&sigset, signo); zend_sigprocmask(SIG_UNBLOCK, &sigset, NULL); } - - return SUCCESS; } /* }}} */ /* {{{ zend_signal * Register a signal handler that will be deferred in critical sections */ -ZEND_API int zend_signal(int signo, void (*handler)(int)) +ZEND_API void zend_signal(int signo, void (*handler)(int)) { struct sigaction sa; @@ -275,7 +273,7 @@ ZEND_API int zend_signal(int signo, void (*handler)(int)) sa.sa_handler = handler; sa.sa_mask = global_sigmask; - return zend_sigaction(signo, &sa, NULL); + zend_sigaction(signo, &sa, NULL); } /* }}} */ @@ -283,7 +281,7 @@ ZEND_API int zend_signal(int signo, void (*handler)(int)) * Set a handler for a signal we want to defer. * Previously set handler must have been saved before. */ -static int zend_signal_register(int signo, void (*handler)(int, siginfo_t*, void*)) +static zend_result zend_signal_register(int signo, void (*handler)(int, siginfo_t*, void*)) { struct sigaction sa; diff --git a/Zend/zend_signal.h b/Zend/zend_signal.h index 0bb191db73..08c9de20c7 100644 --- a/Zend/zend_signal.h +++ b/Zend/zend_signal.h @@ -91,8 +91,8 @@ ZEND_API void zend_signal_startup(void); END_EXTERN_C() void zend_signal_init(void); -ZEND_API int zend_signal(int signo, void (*handler)(int)); -ZEND_API int zend_sigaction(int signo, const struct sigaction *act, struct sigaction *oldact); +ZEND_API void zend_signal(int signo, void (*handler)(int)); +ZEND_API void zend_sigaction(int signo, const struct sigaction *act, struct sigaction *oldact); #else /* ZEND_SIGNALS */ diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c index 51f68b5c9a..1255c941a0 100644 --- a/Zend/zend_stack.c +++ b/Zend/zend_stack.c @@ -22,13 +22,12 @@ #define ZEND_STACK_ELEMENT(stack, n) ((void *)((char *) (stack)->elements + (stack)->size * (n))) -ZEND_API int zend_stack_init(zend_stack *stack, int size) +ZEND_API void zend_stack_init(zend_stack *stack, int size) { stack->size = size; stack->top = 0; stack->max = 0; stack->elements = NULL; - return SUCCESS; } ZEND_API int zend_stack_push(zend_stack *stack, const void *element) @@ -53,10 +52,9 @@ ZEND_API void *zend_stack_top(const zend_stack *stack) } -ZEND_API int zend_stack_del_top(zend_stack *stack) +ZEND_API void zend_stack_del_top(zend_stack *stack) { --stack->top; - return SUCCESS; } @@ -71,20 +69,18 @@ ZEND_API int zend_stack_int_top(const zend_stack *stack) } -ZEND_API int zend_stack_is_empty(const zend_stack *stack) +ZEND_API bool zend_stack_is_empty(const zend_stack *stack) { return stack->top == 0; } -ZEND_API int zend_stack_destroy(zend_stack *stack) +ZEND_API void zend_stack_destroy(zend_stack *stack) { if (stack->elements) { efree(stack->elements); stack->elements = NULL; } - - return SUCCESS; } diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h index 912850a25e..a5aa962226 100644 --- a/Zend/zend_stack.h +++ b/Zend/zend_stack.h @@ -29,13 +29,13 @@ typedef struct _zend_stack { #define STACK_BLOCK_SIZE 16 BEGIN_EXTERN_C() -ZEND_API int zend_stack_init(zend_stack *stack, int size); +ZEND_API void zend_stack_init(zend_stack *stack, int size); ZEND_API int zend_stack_push(zend_stack *stack, const void *element); ZEND_API void *zend_stack_top(const zend_stack *stack); -ZEND_API int zend_stack_del_top(zend_stack *stack); +ZEND_API void zend_stack_del_top(zend_stack *stack); ZEND_API int zend_stack_int_top(const zend_stack *stack); -ZEND_API int zend_stack_is_empty(const zend_stack *stack); -ZEND_API int zend_stack_destroy(zend_stack *stack); +ZEND_API bool zend_stack_is_empty(const zend_stack *stack); +ZEND_API void zend_stack_destroy(zend_stack *stack); ZEND_API void *zend_stack_base(const zend_stack *stack); ZEND_API int zend_stack_count(const zend_stack *stack); ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element)); diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index 38b145736b..1dfc5b1bc1 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -73,7 +73,7 @@ ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *fi handle->filename = filename; } -ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle) /* {{{ */ +ZEND_API zend_result zend_stream_open(const char *filename, zend_file_handle *handle) /* {{{ */ { zend_string *opened_path; if (zend_stream_open_function) { @@ -113,7 +113,7 @@ static ssize_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t return file_handle->handle.stream.reader(file_handle->handle.stream.handle, buf, len); } /* }}} */ -ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len) /* {{{ */ +ZEND_API zend_result zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len) /* {{{ */ { size_t file_size; @@ -232,6 +232,7 @@ ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */ } /* }}} */ +/* return int to be compatible with Zend linked list API */ ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2) /* {{{ */ { if (fh1->type != fh2->type) { diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h index 51651add38..023e2d0555 100644 --- a/Zend/zend_stream.h +++ b/Zend/zend_stream.h @@ -66,8 +66,8 @@ typedef struct _zend_file_handle { BEGIN_EXTERN_C() ZEND_API void zend_stream_init_fp(zend_file_handle *handle, FILE *fp, const char *filename); ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *filename); -ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle); -ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len); +ZEND_API zend_result zend_stream_open(const char *filename, zend_file_handle *handle); +ZEND_API zend_result zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len); ZEND_API void zend_file_handle_dtor(zend_file_handle *fh); ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2); END_EXTERN_C() diff --git a/Zend/zend_string.c b/Zend/zend_string.c index 7eae674f08..570aeece61 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -28,8 +28,8 @@ ZEND_API zend_string_init_interned_func_t zend_string_init_interned; static zend_string* ZEND_FASTCALL zend_new_interned_string_permanent(zend_string *str); static zend_string* ZEND_FASTCALL zend_new_interned_string_request(zend_string *str); -static zend_string* ZEND_FASTCALL zend_string_init_interned_permanent(const char *str, size_t size, int permanent); -static zend_string* ZEND_FASTCALL zend_string_init_interned_request(const char *str, size_t size, int permanent); +static zend_string* ZEND_FASTCALL zend_string_init_interned_permanent(const char *str, size_t size, bool permanent); +static zend_string* ZEND_FASTCALL zend_string_init_interned_request(const char *str, size_t size, bool permanent); /* Any strings interned in the startup phase. Common to all the threads, won't be free'd until process exit. If we want an ability to @@ -67,7 +67,7 @@ ZEND_KNOWN_STRINGS(_ZEND_STR_DSC) NULL }; -static zend_always_inline void zend_init_interned_strings_ht(HashTable *interned_strings, int permanent) +static zend_always_inline void zend_init_interned_strings_ht(HashTable *interned_strings, bool permanent) { zend_hash_init(interned_strings, 1024, NULL, _str_dtor, permanent); if (permanent) { @@ -251,7 +251,7 @@ static zend_string* ZEND_FASTCALL zend_new_interned_string_request(zend_string * return ret; } -static zend_string* ZEND_FASTCALL zend_string_init_interned_permanent(const char *str, size_t size, int permanent) +static zend_string* ZEND_FASTCALL zend_string_init_interned_permanent(const char *str, size_t size, bool permanent) { zend_string *ret; zend_ulong h = zend_inline_hash_func(str, size); @@ -267,7 +267,7 @@ static zend_string* ZEND_FASTCALL zend_string_init_interned_permanent(const char return zend_add_interned_string(ret, &interned_strings_permanent, IS_STR_PERMANENT); } -static zend_string* ZEND_FASTCALL zend_string_init_interned_request(const char *str, size_t size, int permanent) +static zend_string* ZEND_FASTCALL zend_string_init_interned_request(const char *str, size_t size, bool permanent) { zend_string *ret; zend_ulong h = zend_inline_hash_func(str, size); diff --git a/Zend/zend_string.h b/Zend/zend_string.h index 98bd735976..316d022e64 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -25,7 +25,7 @@ BEGIN_EXTERN_C() typedef void (*zend_string_copy_storage_func_t)(void); typedef zend_string *(ZEND_FASTCALL *zend_new_interned_string_func_t)(zend_string *str); -typedef zend_string *(ZEND_FASTCALL *zend_string_init_interned_func_t)(const char *str, size_t size, int permanent); +typedef zend_string *(ZEND_FASTCALL *zend_string_init_interned_func_t)(const char *str, size_t size, bool permanent); ZEND_API extern zend_new_interned_string_func_t zend_new_interned_string; ZEND_API extern zend_string_init_interned_func_t zend_string_init_interned; @@ -136,7 +136,7 @@ static zend_always_inline uint32_t zend_string_delref(zend_string *s) return 1; } -static zend_always_inline zend_string *zend_string_alloc(size_t len, int persistent) +static zend_always_inline zend_string *zend_string_alloc(size_t len, bool persistent) { zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); @@ -147,7 +147,7 @@ static zend_always_inline zend_string *zend_string_alloc(size_t len, int persist return ret; } -static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m, size_t l, int persistent) +static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m, size_t l, bool persistent) { zend_string *ret = (zend_string *)safe_pemalloc(n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent); @@ -158,7 +158,7 @@ static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m return ret; } -static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, int persistent) +static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, bool persistent) { zend_string *ret = zend_string_alloc(len, persistent); @@ -186,7 +186,7 @@ static zend_always_inline zend_string *zend_string_copy(zend_string *s) return s; } -static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persistent) +static zend_always_inline zend_string *zend_string_dup(zend_string *s, bool persistent) { if (ZSTR_IS_INTERNED(s)) { return s; @@ -195,7 +195,7 @@ static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persi } } -static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, int persistent) +static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, bool persistent) { zend_string *ret; @@ -214,7 +214,7 @@ static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_ return ret; } -static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t len, int persistent) +static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t len, bool persistent) { zend_string *ret; @@ -234,7 +234,7 @@ static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t return ret; } -static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size_t len, int persistent) +static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size_t len, bool persistent) { zend_string *ret; @@ -254,7 +254,7 @@ static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size return ret; } -static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, int persistent) +static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, bool persistent) { zend_string *ret; @@ -298,7 +298,7 @@ static zend_always_inline void zend_string_release(zend_string *s) } } -static zend_always_inline void zend_string_release_ex(zend_string *s, int persistent) +static zend_always_inline void zend_string_release_ex(zend_string *s, bool persistent) { if (!ZSTR_IS_INTERNED(s)) { if (GC_DELREF(s) == 0) { diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c index daa9aafefa..d4e972d0e3 100644 --- a/Zend/zend_ts_hash.c +++ b/Zend/zend_ts_hash.c @@ -186,9 +186,9 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun end_write(ht); } -ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key) +ZEND_API zend_result zend_ts_hash_del(TsHashTable *ht, zend_string *key) { - int retval; + zend_result retval; begin_write(ht); retval = zend_hash_del(TS_HASH(ht), key); @@ -197,9 +197,9 @@ ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key) return retval; } -ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h) +ZEND_API zend_result zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h) { - int retval; + zend_result retval; begin_write(ht); retval = zend_hash_index_del(TS_HASH(ht), h); @@ -246,7 +246,7 @@ ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, end_read(source); } -ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite) +ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, bool overwrite) { begin_read(source); begin_write(target); @@ -264,7 +264,7 @@ ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, co end_read(source); } -ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, int renumber) +ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, bool renumber) { begin_write(ht); zend_hash_sort_ex(TS_HASH(ht), sort_func, compare_func, renumber); diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h index 3f245d2120..51801e4e05 100644 --- a/Zend/zend_ts_hash.h +++ b/Zend/zend_ts_hash.h @@ -56,8 +56,8 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun /* Deletes */ -ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key); -ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h); +ZEND_API zend_result zend_ts_hash_del(TsHashTable *ht, zend_string *key); +ZEND_API zend_result zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h); /* Data retrieval */ ZEND_API zval *zend_ts_hash_find(TsHashTable *ht, zend_string *key); @@ -66,10 +66,10 @@ ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, zend_ulong); /* Copying, merging and sorting */ ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor); ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor); -ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite); +ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, bool overwrite); ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, merge_checker_func_t pMergeSource, void *pParam); -ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, int renumber); -ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered); +ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, bool renumber); +ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered); ZEND_API zval *zend_ts_hash_minmax(TsHashTable *ht, bucket_compare_func_t compar, int flag); ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht); @@ -112,12 +112,12 @@ static zend_always_inline void *zend_ts_hash_str_add_ptr(TsHashTable *ht, const return zv ? Z_PTR_P(zv) : NULL; } -static zend_always_inline int zend_ts_hash_exists(TsHashTable *ht, zend_string *key) +static zend_always_inline bool zend_ts_hash_exists(TsHashTable *ht, zend_string *key) { return zend_ts_hash_find(ht, key) != NULL; } -static zend_always_inline int zend_ts_hash_index_exists(TsHashTable *ht, zend_ulong h) +static zend_always_inline bool zend_ts_hash_index_exists(TsHashTable *ht, zend_ulong h) { return zend_ts_hash_index_find(ht, h) != NULL; } diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 7796979ed8..745be6e938 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -55,6 +55,8 @@ typedef enum { FAILURE = -1, /* this MUST stay a negative number, or it may affect functions! */ } ZEND_RESULT_CODE; +typedef ZEND_RESULT_CODE zend_result; + #ifdef ZEND_ENABLE_ZVAL_LONG64 # ifdef ZEND_WIN32 # define ZEND_SIZE_MAX _UI64_MAX diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 61542bfce2..250d1704dc 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -483,7 +483,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void) #undef LINK_MAX #define LINK_MAX 32 -static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, time_t *t, int use_realpath, int is_dir, int *link_is_dir) /* {{{ */ +static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, time_t *t, int use_realpath, bool is_dir, int *link_is_dir) /* {{{ */ { size_t i, j; int directory = 0, save; @@ -996,7 +996,7 @@ retry_reparse_tag_cloud: /* }}} */ /* Resolve path relatively to state and put the real path into state */ -/* returns 0 for ok, 1 for error */ +/* returns 0 for ok, 1 for error, -1 if (path_length >= MAXPATHLEN-1) */ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath) /* {{{ */ { size_t path_length = strlen(path); @@ -1005,7 +1005,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func int ll = 0; time_t t; int ret; - int add_slash; + bool add_slash; void *tmp; if (!path_length || path_length >= MAXPATHLEN-1) { @@ -1178,12 +1178,14 @@ verify: } /* }}} */ -CWD_API int virtual_chdir(const char *path) /* {{{ */ +CWD_API zend_result virtual_chdir(const char *path) /* {{{ */ { - return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH)?-1:0; + return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH) ? FAILURE : SUCCESS; } /* }}} */ + +/* returns 0 for ok, 1 for empty string, -1 on error */ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path)) /* {{{ */ { size_t length = strlen(path); @@ -1255,6 +1257,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path) /* {{{ */ } /* }}} */ +/* returns 0 for ok, 1 for error, -1 if (path_length >= MAXPATHLEN-1) */ CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path) /* {{{ */ { cwd_state new_state; @@ -1270,6 +1273,7 @@ CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_f } /* }}} */ +/* returns 0 for ok, 1 for error, -1 if (path_length >= MAXPATHLEN-1) */ CWD_API int virtual_filepath(const char *path, char **filepath) /* {{{ */ { return virtual_filepath_ex(path, filepath, php_is_file_ok); diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h index 84a1562c77..dfaa95932c 100644 --- a/Zend/zend_virtual_cwd.h +++ b/Zend/zend_virtual_cwd.h @@ -189,6 +189,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li /* One of the following constants must be used as the last argument in virtual_file_ex() call. */ +// TODO Make this into an enum #define CWD_EXPAND 0 /* expand "." and ".." but don't resolve symlinks */ #define CWD_FILEPATH 1 /* resolve symlinks if file is exist otherwise expand */ #define CWD_REALPATH 2 /* call realpath(), resolve symlinks. File must exist */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 4d72cf31ad..00bb179561 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -549,7 +549,7 @@ ZEND_VM_C_LABEL(is_equal_double): } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -629,7 +629,7 @@ ZEND_VM_C_LABEL(is_not_equal_double): } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -2993,7 +2993,7 @@ ZEND_VM_COLD_CONST_HANDLER(46, ZEND_JMPZ_EX, CONST|TMPVAR|CV, JMP_ADDR) { USE_OPLINE zval *val; - int ret; + bool ret; val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -3029,7 +3029,7 @@ ZEND_VM_COLD_CONST_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMPVAR|CV, JMP_ADDR) { USE_OPLINE zval *val; - int ret; + bool ret; val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -4982,7 +4982,7 @@ ZEND_VM_C_LABEL(send_again): // TODO: Speed this up using a flag that specifies whether there are any ref parameters. if ((OP1_TYPE & (IS_VAR|IS_CV)) && Z_REFCOUNT_P(args) > 1) { uint32_t tmp_arg_num = arg_num; - int separate = 0; + bool separate = 0; /* check if any of arguments are going to be passed by reference */ ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) { @@ -5591,7 +5591,7 @@ ZEND_VM_C_LABEL(case_double): } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); FREE_OP2(); if (result) { ZEND_VM_C_GOTO(case_true); @@ -6950,7 +6950,7 @@ ZEND_VM_HOT_HANDLER(154, ZEND_ISSET_ISEMPTY_CV, CV, UNUSED, ISSET, SPEC(ISSET)) ZEND_VM_SMART_BRANCH_FALSE(); } } else { - int result; + bool result; SAVE_OPLINE(); result = !i_zend_is_true(value); @@ -6962,6 +6962,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH| { USE_OPLINE zval *value; + /* Should be bool result? as below got: result = (opline->extended_value & ZEND_ISEMPTY) */ int result; zval *varname; zend_string *name, *tmp_name; @@ -7007,17 +7008,18 @@ ZEND_VM_HANDLER(180, ZEND_ISSET_ISEMPTY_STATIC_PROP, ANY, CLASS_FETCH, ISSET|CAC { USE_OPLINE zval *value; - int result; + zend_result fetch_result; + bool result; SAVE_OPLINE(); - result = zend_fetch_static_property_address(&value, NULL, opline->extended_value & ~ZEND_ISEMPTY, BP_VAR_IS, 0 OPLINE_CC EXECUTE_DATA_CC); + fetch_result = zend_fetch_static_property_address(&value, NULL, opline->extended_value & ~ZEND_ISEMPTY, BP_VAR_IS, 0 OPLINE_CC EXECUTE_DATA_CC); if (!(opline->extended_value & ZEND_ISEMPTY)) { - result = result == SUCCESS && Z_TYPE_P(value) > IS_NULL && + result = fetch_result == SUCCESS && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); } else { - result = result != SUCCESS || !i_zend_is_true(value); + result = fetch_result != SUCCESS || !i_zend_is_true(value); } ZEND_VM_SMART_BRANCH(result, 1); @@ -7027,7 +7029,7 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, CONST|TMPVAR|CV { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -7267,7 +7269,7 @@ ZEND_VM_COLD_CONST_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, JMP_ADDR) USE_OPLINE zval *value; zval *ref = NULL; - int ret; + bool ret; SAVE_OPLINE(); value = GET_OP1_ZVAL_PTR(BP_VAR_R); @@ -9206,7 +9208,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL|ZEND_IS_IDENTICAL, (op1_info == MAY_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9218,7 +9220,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL|ZEND_IS_IDENTICAL, (op1_info == MAY_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9230,7 +9232,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL|ZEND_IS_NOT_IDENTICAL, (op1_info { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9242,7 +9244,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL|ZEND_IS_NOT_IDENTICAL, (op1_info { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9283,7 +9285,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_LONG && op2_i { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9295,7 +9297,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_DOUBLE && op2 { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9307,7 +9309,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_LONG { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -9319,7 +9321,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_DOUB { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index a46b39d027..e6712b86af 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1870,7 +1870,7 @@ send_again: // TODO: Speed this up using a flag that specifies whether there are any ref parameters. if ((opline->op1_type & (IS_VAR|IS_CV)) && Z_REFCOUNT_P(args) > 1) { uint32_t tmp_arg_num = arg_num; - int separate = 0; + bool separate = 0; /* check if any of arguments are going to be passed by reference */ ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) { @@ -2405,17 +2405,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_STATIC_PROP_SPEC { USE_OPLINE zval *value; - int result; + zend_result fetch_result; + bool result; SAVE_OPLINE(); - result = zend_fetch_static_property_address(&value, NULL, opline->extended_value & ~ZEND_ISEMPTY, BP_VAR_IS, 0 OPLINE_CC EXECUTE_DATA_CC); + fetch_result = zend_fetch_static_property_address(&value, NULL, opline->extended_value & ~ZEND_ISEMPTY, BP_VAR_IS, 0 OPLINE_CC EXECUTE_DATA_CC); if (!(opline->extended_value & ZEND_ISEMPTY)) { - result = result == SUCCESS && Z_TYPE_P(value) > IS_NULL && + result = fetch_result == SUCCESS && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); } else { - result = result != SUCCESS || !i_zend_is_true(value); + result = fetch_result != SUCCESS || !i_zend_is_true(value); } ZEND_VM_SMART_BRANCH(result, 1); @@ -3554,7 +3555,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CONS { USE_OPLINE zval *val; - int ret; + bool ret; val = RT_CONSTANT(opline, opline->op1); @@ -3590,7 +3591,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CON { USE_OPLINE zval *val; - int ret; + bool ret; val = RT_CONSTANT(opline, opline->op1); @@ -4300,7 +4301,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONS USE_OPLINE zval *value; zval *ref = NULL; - int ret; + bool ret; SAVE_OPLINE(); value = RT_CONSTANT(opline, opline->op1); @@ -5016,7 +5017,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CONST & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -5074,7 +5075,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CONST & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -6315,7 +6316,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -7248,7 +7249,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_CONST_TMP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7260,7 +7261,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7272,7 +7273,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7284,7 +7285,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_T { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7296,7 +7297,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7308,7 +7309,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7320,7 +7321,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7332,7 +7333,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7344,7 +7345,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7356,7 +7357,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7368,7 +7369,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -7380,7 +7381,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = RT_CONSTANT(opline, opline->op1); op2 = EX_VAR(opline->op2.var); @@ -8471,7 +8472,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CON { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -9425,6 +9426,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_U { USE_OPLINE zval *value; + /* Should be bool result? as below got: result = (opline->extended_value & ZEND_ISEMPTY) */ int result; zval *varname; zend_string *name, *tmp_name; @@ -10854,7 +10856,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CON { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -11951,7 +11953,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CO { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -11963,7 +11965,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -11975,7 +11977,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -11987,7 +11989,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -11999,7 +12001,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12011,7 +12013,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12023,7 +12025,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12035,7 +12037,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12047,7 +12049,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12059,7 +12061,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12071,7 +12073,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12083,7 +12085,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12095,7 +12097,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12107,7 +12109,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12119,7 +12121,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12131,7 +12133,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12143,7 +12145,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12155,7 +12157,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12167,7 +12169,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12179,7 +12181,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12191,7 +12193,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12203,7 +12205,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12215,7 +12217,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12227,7 +12229,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = RT_CONSTANT(opline, opline->op2); @@ -12857,7 +12859,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TM { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12869,7 +12871,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12881,7 +12883,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12893,7 +12895,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12905,7 +12907,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12917,7 +12919,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12929,7 +12931,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12941,7 +12943,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12953,7 +12955,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12965,7 +12967,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12977,7 +12979,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -12989,7 +12991,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13001,7 +13003,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13013,7 +13015,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13025,7 +13027,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13037,7 +13039,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARC { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13049,7 +13051,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13061,7 +13063,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13073,7 +13075,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_ { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13085,7 +13087,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13097,7 +13099,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13109,7 +13111,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13121,7 +13123,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13133,7 +13135,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA { USE_OPLINE zval *op1, *op2; - int result; + bool result; op1 = EX_VAR(opline->op1.var); op2 = EX_VAR(opline->op2.var); @@ -13338,7 +13340,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_TMPVAR_HANDLER(ZE { USE_OPLINE zval *val; - int ret; + bool ret; val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC); @@ -13374,7 +13376,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_TMPVAR_HANDLER(Z { USE_OPLINE zval *val; - int ret; + bool ret; val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC); @@ -14024,7 +14026,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14082,7 +14084,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14140,7 +14142,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14198,7 +14200,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14256,7 +14258,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14314,7 +14316,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -14981,7 +14983,7 @@ case_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (result) { goto case_true; @@ -14997,7 +14999,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -15444,7 +15446,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -15502,7 +15504,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -15560,7 +15562,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -15618,7 +15620,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -15676,7 +15678,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -15734,7 +15736,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -16373,7 +16375,7 @@ case_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); zval_ptr_dtor_nogc(EX_VAR(opline->op2.var)); if (result) { goto case_true; @@ -16389,7 +16391,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -16787,6 +16789,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMPVAR_ { USE_OPLINE zval *value; + /* Should be bool result? as below got: result = (opline->extended_value & ZEND_ISEMPTY) */ int result; zval *varname; zend_string *name, *tmp_name; @@ -17686,7 +17689,7 @@ case_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (result) { goto case_true; @@ -17702,7 +17705,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -18311,7 +18314,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_ USE_OPLINE zval *value; zval *ref = NULL; - int ret; + bool ret; SAVE_OPLINE(); value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC); @@ -21184,7 +21187,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_ USE_OPLINE zval *value; zval *ref = NULL; - int ret; + bool ret; SAVE_OPLINE(); value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC); @@ -36856,7 +36859,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CV_HANDLER(ZEND_O { USE_OPLINE zval *val; - int ret; + bool ret; val = EX_VAR(opline->op1.var); @@ -36892,7 +36895,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CV_HANDLER(ZEND_ { USE_OPLINE zval *val; - int ret; + bool ret; val = EX_VAR(opline->op1.var); @@ -37551,7 +37554,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CV_HANDLER(ZEND_O USE_OPLINE zval *value; zval *ref = NULL; - int ret; + bool ret; SAVE_OPLINE(); value = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC); @@ -38257,7 +38260,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -38315,7 +38318,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -38373,7 +38376,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -38431,7 +38434,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -38489,7 +38492,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -38547,7 +38550,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -41169,7 +41172,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_ { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -41885,7 +41888,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -41943,7 +41946,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -42001,7 +42004,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -42059,7 +42062,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -42117,7 +42120,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -42175,7 +42178,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -44617,7 +44620,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_ { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; @@ -46290,7 +46293,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_CV_S ZEND_VM_SMART_BRANCH_FALSE(); } } else { - int result; + bool result; SAVE_OPLINE(); result = !i_zend_is_true(value); @@ -46312,7 +46315,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_CV_S ZEND_VM_SMART_BRANCH_FALSE(); } } else { - int result; + bool result; SAVE_OPLINE(); result = !i_zend_is_true(value); @@ -46324,6 +46327,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUS { USE_OPLINE zval *value; + /* Should be bool result? as below got: result = (opline->extended_value & ZEND_ISEMPTY) */ int result; zval *varname; zend_string *name, *tmp_name; @@ -46939,7 +46943,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -46997,7 +47001,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -47055,7 +47059,7 @@ is_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -47113,7 +47117,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -47171,7 +47175,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -47229,7 +47233,7 @@ is_not_equal_double: } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { - int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); + bool result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); if (IS_CV & (IS_TMP_VAR|IS_VAR)) { zval_ptr_dtor_str(op1); } @@ -49739,7 +49743,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_ { USE_OPLINE zval *container; - int result; + bool result; zend_ulong hval; zval *offset; diff --git a/Zend/zend_weakrefs.c b/Zend/zend_weakrefs.c index 10641fe435..04c5043210 100644 --- a/Zend/zend_weakrefs.c +++ b/Zend/zend_weakrefs.c @@ -344,6 +344,7 @@ static void zend_weakmap_write_dimension(zend_object *object, zval *offset, zval zend_hash_index_add_new(&wm->ht, (zend_ulong) obj_key, value); } +/* int return and check_empty due to Object Handler API */ static int zend_weakmap_has_dimension(zend_object *object, zval *offset, int check_empty) { if (Z_TYPE_P(offset) != IS_OBJECT) { @@ -512,6 +513,7 @@ static const zend_object_iterator_funcs zend_weakmap_iterator_funcs = { NULL, /* get_gc */ }; +/* by_ref is int due to Iterator API */ static zend_object_iterator *zend_weakmap_get_iterator( zend_class_entry *ce, zval *object, int by_ref) { diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 2da4769aa5..b27fbef012 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -1235,7 +1235,7 @@ PHP_FUNCTION(ftp_close) ftp_quit(ftp); - RETURN_BOOL(zend_list_close(Z_RES_P(z_ftp)) == SUCCESS); + RETURN_TRUE; } /* }}} */ diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 7bed59422c..e32ed281ee 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -296,12 +296,12 @@ static size_t count_commas(const char *p, const char *end) { return count; } -/* {{{ static int php_mb_parse_encoding_list() +/* {{{ static zend_result php_mb_parse_encoding_list() * Return FAILURE if input contains any illegal encoding, otherwise SUCCESS. * Emits a ValueError in function context and a warning in INI context, in INI context arg_num must be 0. */ -static int php_mb_parse_encoding_list(const char *value, size_t value_length, - const mbfl_encoding ***return_list, size_t *return_size, int persistent, uint32_t arg_num, +static zend_result php_mb_parse_encoding_list(const char *value, size_t value_length, + const mbfl_encoding ***return_list, size_t *return_size, bool persistent, uint32_t arg_num, zend_bool allow_pass_encoding) { if (value == NULL || value_length == 0) { @@ -450,7 +450,7 @@ static const char *php_mb_zend_encoding_name_getter(const zend_encoding *encodin return ((const mbfl_encoding *)encoding)->name; } -static int php_mb_zend_encoding_lexer_compatibility_checker(const zend_encoding *_encoding) +static bool php_mb_zend_encoding_lexer_compatibility_checker(const zend_encoding *_encoding) { const mbfl_encoding *encoding = (const mbfl_encoding*)_encoding; if (encoding->flag & MBFL_ENCTYPE_SBCS) { @@ -521,7 +521,7 @@ static size_t php_mb_zend_encoding_converter(unsigned char **to, size_t *to_leng return loc; } -static int php_mb_zend_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent) +static zend_result php_mb_zend_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, bool persistent) { return php_mb_parse_encoding_list( encoding_list, encoding_list_len, @@ -534,7 +534,7 @@ static const zend_encoding *php_mb_zend_internal_encoding_getter(void) return (const zend_encoding *)MBSTRG(internal_encoding); } -static int php_mb_zend_internal_encoding_setter(const zend_encoding *encoding) +static zend_result php_mb_zend_internal_encoding_setter(const zend_encoding *encoding) { MBSTRG(internal_encoding) = (const mbfl_encoding *)encoding; return SUCCESS; diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c index ec698a265d..ab02d5645a 100644 --- a/ext/mysqlnd/mysqlnd_debug.c +++ b/ext/mysqlnd/mysqlnd_debug.c @@ -412,7 +412,8 @@ MYSQLND_METHOD(mysqlnd_debug, func_leave)(MYSQLND_DEBUG * self, unsigned int lin #endif } - return zend_stack_del_top(&self->call_stack) == SUCCESS? PASS:FAIL; + zend_stack_del_top(&self->call_stack); + return PASS; } /* }}} */ diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index 1615423abe..d0dffc275d 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -788,7 +788,7 @@ static inline int ct_eval_func_call( uint32_t i; zend_execute_data *execute_data, *prev_execute_data; zend_function *func; - int overflow; + bool overflow; if (num_args == 0) { if (zend_string_equals_literal(name, "php_sapi_name") diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index bde6e0eb71..9ee1a5b5d7 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -119,15 +119,15 @@ zend_bool fallback_process = 0; /* process uses file cache fallback */ #endif static zend_op_array *(*accelerator_orig_compile_file)(zend_file_handle *file_handle, int type); -static int (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle ); +static zend_result (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle ); static zend_string *(*accelerator_orig_zend_resolve_path)(const char *filename, size_t filename_len); static void (*accelerator_orig_zend_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); static zif_handler orig_chdir = NULL; static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL; -static int (*orig_post_startup_cb)(void); +static zend_result (*orig_post_startup_cb)(void); static void accel_gen_system_id(void); -static int accel_post_startup(void); +static zend_result accel_post_startup(void); static int accel_finish_startup(void); static void preload_shutdown(void); @@ -304,7 +304,7 @@ static inline int accel_restart_is_active(void) } /* Creates a read lock for SHM access */ -static inline int accel_activate_add(void) +static inline zend_result accel_activate_add(void) { #ifdef ZEND_WIN32 SHM_UNPROTECT(); @@ -551,7 +551,7 @@ static zend_always_inline zend_string *accel_find_interned_string_ex(zend_ulong return NULL; } -static zend_string* ZEND_FASTCALL accel_init_interned_string_for_php(const char *str, size_t size, int permanent) +static zend_string* ZEND_FASTCALL accel_init_interned_string_for_php(const char *str, size_t size, bool permanent) { if (ZCG(counted)) { zend_ulong h = zend_inline_hash_func(str, size); @@ -2269,7 +2269,7 @@ static int accel_gen_uname_id(void) #endif /* zend_stream_open_function() replacement for PHP 5.3 and above */ -static int persistent_stream_open_function(const char *filename, zend_file_handle *handle) +static zend_result persistent_stream_open_function(const char *filename, zend_file_handle *handle) { if (ZCG(cache_persistent_script)) { /* check if callback is called from include_once or it's a main request */ @@ -2400,7 +2400,7 @@ static void accel_reset_pcre_cache(void) } ZEND_HASH_FOREACH_END(); } -int accel_activate(INIT_FUNC_ARGS) +zend_result accel_activate(INIT_FUNC_ARGS) { if (!ZCG(enabled) || !accel_startup_ok) { ZCG(accelerator_enabled) = 0; @@ -2963,13 +2963,13 @@ static int accel_startup(zend_extension *extension) return SUCCESS; } -static int accel_post_startup(void) +static zend_result accel_post_startup(void) { zend_function *func; zend_ini_entry *ini_entry; if (orig_post_startup_cb) { - int (*cb)(void) = orig_post_startup_cb; + zend_result (*cb)(void) = orig_post_startup_cb; orig_post_startup_cb = NULL; if (cb() != SUCCESS) { @@ -4368,7 +4368,7 @@ static void preload_load(void) } } -static int preload_autoload(zend_string *filename) +static zend_result preload_autoload(zend_string *filename) { zend_persistent_script *persistent_script; zend_op_array *op_array; diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 05a05fa1b6..0d6dda86a1 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -316,7 +316,7 @@ extern zend_accel_globals accel_globals; extern char *zps_api_failure_reason; void accel_shutdown(void); -int accel_activate(INIT_FUNC_ARGS); +zend_result accel_activate(INIT_FUNC_ARGS); int accel_post_deactivate(void); void zend_accel_schedule_restart(zend_accel_restart_reason reason); void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason); diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c index 95b4a16d6d..d618800480 100644 --- a/ext/pcntl/php_signal.c +++ b/ext/pcntl/php_signal.c @@ -48,9 +48,7 @@ Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all) act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */ #endif } - if (zend_sigaction(signo, &act, &oact) < 0) { - return (void*)SIG_ERR; - } + zend_sigaction(signo, &act, &oact); #ifdef HAVE_STRUCT_SIGINFO_T return oact.sa_sigaction; diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 9eeed75b04..18e4985da2 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1986,14 +1986,7 @@ PHP_FUNCTION(highlight_string) hicompiled_string_description = zend_make_compiled_string_description("highlighted code"); - if (highlight_string(expr, &syntax_highlighter_ini, hicompiled_string_description) == FAILURE) { - efree(hicompiled_string_description); - EG(error_reporting) = old_error_reporting; - if (i) { - php_output_end(); - } - RETURN_FALSE; - } + highlight_string(expr, &syntax_highlighter_ini, hicompiled_string_description); efree(hicompiled_string_description); EG(error_reporting) = old_error_reporting; @@ -2003,6 +1996,7 @@ PHP_FUNCTION(highlight_string) php_output_discard(); ZEND_ASSERT(Z_TYPE_P(return_value) == IS_STRING); } else { + // TODO Make this function void? RETURN_TRUE; } } diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 1cfce579b0..affe637e04 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -1250,13 +1250,9 @@ PHP_FUNCTION(stream_filter_remove) RETURN_FALSE; } - if (zend_list_close(Z_RES_P(zfilter)) == FAILURE) { - php_error_docref(NULL, E_WARNING, "Could not invalidate filter, not removing"); - RETURN_FALSE; - } else { - php_stream_filter_remove(filter, 1); - RETURN_TRUE; - } + zend_list_close(Z_RES_P(zfilter)); + php_stream_filter_remove(filter, 1); + RETURN_TRUE; } /* }}} */ diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index 2656ce8f73..d12b5edba8 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -358,10 +358,7 @@ static zend_bool tokenize(zval *return_value, zend_string *source, zend_class_en ZVAL_STR_COPY(&source_zval, source); zend_save_lexical_state(&original_lex_state); - if (zend_prepare_string_for_scanning(&source_zval, "") == FAILURE) { - zend_restore_lexical_state(&original_lex_state); - return 0; - } + zend_prepare_string_for_scanning(&source_zval, ""); LANG_SCNG(yy_state) = yycINITIAL; zend_hash_init(&interned_strings, 0, NULL, NULL, 0); @@ -484,6 +481,8 @@ static zend_bool tokenize_parse( zval *return_value, zend_string *source, zend_class_entry *token_class) { zval source_zval; + struct event_context ctx; + zval token_stream; zend_lex_state original_lex_state; zend_bool original_in_compilation; zend_bool success; @@ -494,30 +493,27 @@ static zend_bool tokenize_parse( CG(in_compilation) = 1; zend_save_lexical_state(&original_lex_state); - if ((success = (zend_prepare_string_for_scanning(&source_zval, "") == SUCCESS))) { - struct event_context ctx; - zval token_stream; - array_init(&token_stream); - - ctx.tokens = &token_stream; - ctx.token_class = token_class; + zend_prepare_string_for_scanning(&source_zval, ""); + array_init(&token_stream); - CG(ast) = NULL; - CG(ast_arena) = zend_arena_create(1024 * 32); - LANG_SCNG(yy_state) = yycINITIAL; - LANG_SCNG(on_event) = on_event; - LANG_SCNG(on_event_context) = &ctx; + ctx.tokens = &token_stream; + ctx.token_class = token_class; - if((success = (zendparse() == SUCCESS))) { - ZVAL_COPY_VALUE(return_value, &token_stream); - } else { - zval_ptr_dtor(&token_stream); - } + CG(ast) = NULL; + CG(ast_arena) = zend_arena_create(1024 * 32); + LANG_SCNG(yy_state) = yycINITIAL; + LANG_SCNG(on_event) = on_event; + LANG_SCNG(on_event_context) = &ctx; - zend_ast_destroy(CG(ast)); - zend_arena_destroy(CG(ast_arena)); + if((success = (zendparse() == SUCCESS))) { + ZVAL_COPY_VALUE(return_value, &token_stream); + } else { + zval_ptr_dtor(&token_stream); } + zend_ast_destroy(CG(ast)); + zend_arena_destroy(CG(ast_arena)); + /* restore compiler and scanner global states */ zend_restore_lexical_state(&original_lex_state); CG(in_compilation) = original_in_compilation; diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 43c2da9af6..c1a569afec 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -1290,7 +1290,8 @@ PHP_FUNCTION(zip_entry_close) RETURN_THROWS(); } - RETURN_BOOL(SUCCESS == zend_list_close(Z_RES_P(zip_entry))); + zend_list_close(Z_RES_P(zip_entry)); + RETURN_TRUE; } /* }}} */ diff --git a/main/main.c b/main/main.c index 9ac65da922..c9cb9b2d85 100644 --- a/main/main.c +++ b/main/main.c @@ -268,7 +268,8 @@ static PHP_INI_MH(OnChangeMemoryLimit) } else { PG(memory_limit) = Z_L(1)<<30; /* effectively, no limit */ } - return zend_set_memory_limit(PG(memory_limit)); + zend_set_memory_limit(PG(memory_limit)); + return SUCCESS; } /* }}} */ @@ -1520,13 +1521,13 @@ static size_t php_zend_stream_fsizer(void *handle) /* {{{ */ } /* }}} */ -static int php_stream_open_for_zend(const char *filename, zend_file_handle *handle) /* {{{ */ +static zend_result php_stream_open_for_zend(const char *filename, zend_file_handle *handle) /* {{{ */ { return php_stream_open_for_zend_ex(filename, handle, USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE); } /* }}} */ -PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode) /* {{{ */ +PHPAPI zend_result php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode) /* {{{ */ { zend_string *opened_path; php_stream *stream = php_stream_open_wrapper((char *)filename, "rb", mode, &opened_path); |