diff options
author | George Peter Banyard <girgias@php.net> | 2020-08-28 15:41:27 +0200 |
---|---|---|
committer | George Peter Banyard <girgias@php.net> | 2020-08-28 15:41:27 +0200 |
commit | fa8d9b1183f961cb6e0f0ef5a2d1b1d3744fe35b (patch) | |
tree | a00044117c3f56969a7b77b466bbdbdd45d66db7 /Zend/zend_execute_API.c | |
parent | 7690439edd93bf9dc868cbc34a12fbad6b26e777 (diff) | |
download | php-git-fa8d9b1183f961cb6e0f0ef5a2d1b1d3744fe35b.tar.gz |
Improve type declarations for Zend APIs
Voidification of Zend API which always succeeded
Use bool argument types instead of int for boolean arguments
Use bool return type for functions which return true/false (1/0)
Use zend_result return type for functions which return SUCCESS/FAILURE as they don't follow normal boolean semantics
Closes GH-6002
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r-- | Zend/zend_execute_API.c | 36 |
1 files changed, 18 insertions, 18 deletions
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); |