diff options
author | twosee <twose@qq.com> | 2019-05-26 13:53:26 +0800 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-12 16:49:32 +0200 |
commit | 61f78de4860b951b8548b745f40caef3b5369528 (patch) | |
tree | 37f2ba92c4f37d630e0312cf238e94587f25c1cf | |
parent | ff8002fc7c3cbf9ee01d6d68cccbbd9460314ce4 (diff) | |
download | php-git-61f78de4860b951b8548b745f40caef3b5369528.tar.gz |
Constify some char* arguments or return values of ZEND_API
Closes GH-4247.
-rw-r--r-- | Zend/zend.c | 2 | ||||
-rw-r--r-- | Zend/zend.h | 2 | ||||
-rw-r--r-- | Zend/zend_API.c | 6 | ||||
-rw-r--r-- | Zend/zend_API.h | 6 | ||||
-rw-r--r-- | Zend/zend_compile.c | 2 | ||||
-rw-r--r-- | Zend/zend_compile.h | 4 | ||||
-rw-r--r-- | Zend/zend_constants.c | 4 | ||||
-rw-r--r-- | Zend/zend_constants.h | 4 | ||||
-rw-r--r-- | Zend/zend_execute.h | 8 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 8 | ||||
-rw-r--r-- | Zend/zend_highlight.h | 4 | ||||
-rw-r--r-- | Zend/zend_language_scanner.h | 2 | ||||
-rw-r--r-- | Zend/zend_language_scanner.l | 8 | ||||
-rw-r--r-- | ext/reflection/php_reflection.c | 6 | ||||
-rw-r--r-- | ext/standard/info.c | 2 | ||||
-rw-r--r-- | sapi/phpdbg/phpdbg.h | 2 | ||||
-rw-r--r-- | sapi/phpdbg/phpdbg_list.c | 2 |
17 files changed, 36 insertions, 36 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index d71be2266f..bde93a4abe 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1136,7 +1136,7 @@ ZEND_API void zend_append_version_info(const zend_extension *extension) /* {{{ * } /* }}} */ -ZEND_API char *get_zend_version(void) /* {{{ */ +ZEND_API const char *get_zend_version(void) /* {{{ */ { return zend_version_info; } diff --git a/Zend/zend.h b/Zend/zend.h index a2b76291da..6d7195cee8 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -244,7 +244,7 @@ ZEND_API zend_string *zend_strpprintf(size_t max_len, const char *format, ...) Z ZEND_API size_t zend_spprintf_unchecked(char **message, size_t max_len, const char *format, ...); ZEND_API zend_string *zend_strpprintf_unchecked(size_t max_len, const char *format, ...); -ZEND_API char *get_zend_version(void); +ZEND_API const char *get_zend_version(void); ZEND_API int 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); diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 37a002f003..5904ba5c33 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -95,7 +95,7 @@ ZEND_API ZEND_COLD void zend_wrong_param_count(void) /* {{{ */ /* }}} */ /* Argument parsing API -- andrei */ -ZEND_API char *zend_get_type_by_const(int type) /* {{{ */ +ZEND_API const char *zend_get_type_by_const(int type) /* {{{ */ { switch(type) { case IS_FALSE: @@ -130,7 +130,7 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */ } /* }}} */ -ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */ +ZEND_API const char *zend_zval_type_name(const zval *arg) /* {{{ */ { ZVAL_DEREF(arg); return zend_get_type_by_const(Z_TYPE_P(arg)); @@ -218,7 +218,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(int num, z } /* }}} */ -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, char *name, zval *arg) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, const char *name, zval *arg) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); diff --git a/Zend/zend_API.h b/Zend/zend_API.h index fcc7313084..68245ba4d0 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -257,7 +257,7 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array); ZEND_API int zend_parse_parameters(int num_args, const char *type_spec, ...); ZEND_API int zend_parse_parameters_ex(int flags, int num_args, const char *type_spec, ...); ZEND_API int zend_parse_parameters_throw(int num_args, const char *type_spec, ...); -ZEND_API char *zend_zval_type_name(const zval *arg); +ZEND_API const char *zend_zval_type_name(const zval *arg); ZEND_API zend_string *zend_zval_get_type(const zval *arg); ZEND_API int zend_parse_method_parameters(int num_args, zval *this_ptr, const char *type_spec, ...); @@ -356,7 +356,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c ZEND_API zval *zend_read_static_property_ex(zend_class_entry *scope, zend_string *name, zend_bool silent); ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, zend_bool silent); -ZEND_API char *zend_get_type_by_const(int type); +ZEND_API const char *zend_get_type_by_const(int type); #define ZEND_THIS (&EX(This)) @@ -1112,7 +1112,7 @@ typedef enum _zend_expected_type { ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_error(void); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error(int min_num_args, int max_num_args); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(int num, zend_expected_type expected_type, zval *arg); -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, char *name, zval *arg); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, const char *name, zval *arg); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char *error); #define ZPP_ERROR_OK 0 diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d62ff3ed32..94a571d21c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -71,7 +71,7 @@ static inline uint32_t zend_alloc_cache_slot(void) { } ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type); -ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename); +ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, const char *filename); #ifndef ZTS ZEND_API zend_compiler_globals compiler_globals; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index e8911f732a..0a24564259 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -708,7 +708,7 @@ void zend_file_context_begin(zend_file_context *prev_context); void zend_file_context_end(zend_file_context *prev_context); extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type); -extern ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename); +extern ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, const char *filename); ZEND_API int ZEND_FASTCALL lex_scan(zval *zendlval, zend_parser_stack_elem *elem); void startup_scanner(void); @@ -766,7 +766,7 @@ ZEND_API void function_add_ref(zend_function *function); /* helper functions in zend_language_scanner.l */ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type); -ZEND_API zend_op_array *compile_string(zval *source_string, char *filename); +ZEND_API zend_op_array *compile_string(zval *source_string, const char *filename); ZEND_API zend_op_array *compile_filename(int type, zval *filename); ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...); ZEND_API int open_file_for_scanning(zend_file_handle *file_handle); diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 2c0d8e2725..3148180a9a 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -193,7 +193,7 @@ ZEND_API void zend_register_double_constant(const char *name, size_t name_len, d } -ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, char *strval, size_t strlen, 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_constant c; @@ -204,7 +204,7 @@ ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, } -ZEND_API void zend_register_string_constant(const char *name, size_t name_len, char *strval, 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_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number); } diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h index 4d3335a490..75be4c32b2 100644 --- a/Zend/zend_constants.h +++ b/Zend/zend_constants.h @@ -79,8 +79,8 @@ ZEND_API void zend_register_bool_constant(const char *name, size_t name_len, zen ZEND_API void zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number); ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number); 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, char *strval, int flags, int module_number); -ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, char *strval, size_t strlen, 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); #ifdef ZTS void zend_copy_constants(HashTable *target, HashTable *sourc); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 053d22afd0..6ef9baf252 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -44,10 +44,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(char *str, zval *retval_ptr, char *string_name); -ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char *string_name); -ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions); -ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, char *string_name, int handle_exceptions); +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); /* export zend_pass_function to allow comparisons against it */ extern ZEND_API const zend_internal_function zend_pass_function; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 4ad19d6764..a60883fb74 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -986,7 +986,7 @@ ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex) /* {{{ */ } /* }}} */ -ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char *string_name) /* {{{ */ +ZEND_API int 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; @@ -1050,13 +1050,13 @@ ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char } /* }}} */ -ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name) /* {{{ */ +ZEND_API int 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(char *str, size_t str_len, zval *retval_ptr, 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) /* {{{ */ { int result; @@ -1069,7 +1069,7 @@ ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, c } /* }}} */ -ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions) /* {{{ */ +ZEND_API int zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, int handle_exceptions) /* {{{ */ { return zend_eval_stringl_ex(str, strlen(str), retval_ptr, string_name, handle_exceptions); } diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h index 92a4dbccd3..8ea1518ca6 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(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini); -ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name); +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 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_language_scanner.h b/Zend/zend_language_scanner.h index 3640b9a5ea..4d51a064fc 100644 --- a/Zend/zend_language_scanner.h +++ b/Zend/zend_language_scanner.h @@ -66,7 +66,7 @@ typedef struct _zend_heredoc_label { 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, char *filename); +ZEND_API int 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 void zend_lex_tstring(zval *zv); diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 497b02230b..6d9ce9cea2 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -679,7 +679,7 @@ zend_op_array *compile_filename(int type, zval *filename) return retval; } -ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename) +ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename) { char *buf; size_t size, old_len; @@ -747,7 +747,7 @@ ZEND_API size_t zend_get_scanned_file_offset(void) return offset; } -zend_op_array *compile_string(zval *source_string, char *filename) +zend_op_array *compile_string(zval *source_string, const char *filename) { zend_lex_state original_lex_state; zend_op_array *op_array = NULL; @@ -778,7 +778,7 @@ zend_op_array *compile_string(zval *source_string, char *filename) BEGIN_EXTERN_C() -int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini) +int highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini) { zend_lex_state original_lex_state; zend_file_handle file_handle; @@ -803,7 +803,7 @@ int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlight return SUCCESS; } -int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name) +int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name) { zend_lex_state original_lex_state; zval tmp; diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index ee5f5d82b8..c91d1e199e 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -512,7 +512,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char /* {{{ _const_string */ static void _const_string(smart_str *str, char *name, zval *value, char *indent) { - char *type = zend_zval_type_name(value); + const char *type = zend_zval_type_name(value); if (Z_TYPE_P(value) == IS_ARRAY) { smart_str_append_printf(str, "%s Constant [ %s %s ] { Array }\n", @@ -534,7 +534,7 @@ static void _const_string(smart_str *str, char *name, zval *value, char *indent) static void _class_const_string(smart_str *str, char *name, zend_class_constant *c, char *indent) { char *visibility = zend_visibility_string(Z_ACCESS_FLAGS(c->value)); - char *type; + const char *type; zval_update_constant_ex(&c->value, c->ce); type = zend_zval_type_name(&c->value); @@ -2860,7 +2860,7 @@ static zend_string *reflection_type_name(type_reference *param) { } else if (ZEND_TYPE_IS_CE(param->type)) { return zend_string_copy(ZEND_TYPE_CE(param->type)->name); } else { - char *name = zend_get_type_by_const(ZEND_TYPE_CODE(param->type)); + const char *name = zend_get_type_by_const(ZEND_TYPE_CODE(param->type)); return zend_string_init(name, strlen(name), 0); } } diff --git a/ext/standard/info.c b/ext/standard/info.c index 922663ab48..ff7ead6460 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -770,7 +770,7 @@ PHPAPI ZEND_COLD void php_print_info(int flag) } if (flag & PHP_INFO_GENERAL) { - char *zend_version = get_zend_version(); + const char *zend_version = get_zend_version(); char temp_api[10]; php_uname = php_get_uname('a'); diff --git a/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h index d1b22e6f40..f22d2ce1c2 100644 --- a/sapi/phpdbg/phpdbg.h +++ b/sapi/phpdbg/phpdbg.h @@ -277,7 +277,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg) zend_op_array *(*compile_file)(zend_file_handle *file_handle, int type); zend_op_array *(*init_compile_file)(zend_file_handle *file_handle, int type); - zend_op_array *(*compile_string)(zval *source_string, char *filename); + zend_op_array *(*compile_string)(zval *source_string, const char *filename); HashTable file_sources; FILE *oplog; /* opline log */ diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index 35b023aebe..3631763747 100644 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@ -318,7 +318,7 @@ zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) { return op_array; } -zend_op_array *phpdbg_compile_string(zval *source_string, char *filename) { +zend_op_array *phpdbg_compile_string(zval *source_string, const char *filename) { zend_string *fake_name; zend_op_array *op_array; phpdbg_file_source *dataptr; |