summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2021-03-16 20:31:36 +0300
committerDmitry Stogov <dmitry@zend.com>2021-03-16 20:31:36 +0300
commitc732ab400af92c54eee47c487a56009f1d79dd5d (patch)
tree083d31748450932114a7667aae9235cde030efcb /Zend
parent9bbeb0555b6b842ebd44e08510ff3f3226237544 (diff)
downloadphp-git-c732ab400af92c54eee47c487a56009f1d79dd5d.tar.gz
Change Zend Stream API to use zend_string* instead of char*.
This allows to eliminate re-calculation of string lenght and hash value. See the detailed list of changes in UPGRADING.INTERNALS.
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend.c16
-rw-r--r--Zend/zend.h12
-rw-r--r--Zend/zend_compile.c9
-rw-r--r--Zend/zend_dtrace.c4
-rw-r--r--Zend/zend_execute.c12
-rw-r--r--Zend/zend_execute_API.c2
-rw-r--r--Zend/zend_globals.h2
-rw-r--r--Zend/zend_ini_parser.y1
-rw-r--r--Zend/zend_ini_scanner.l7
-rw-r--r--Zend/zend_language_scanner.l21
-rw-r--r--Zend/zend_llist.c2
-rw-r--r--Zend/zend_stream.c59
-rw-r--r--Zend/zend_stream.h18
13 files changed, 92 insertions, 73 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 9e5c7e2328..822160508a 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -73,15 +73,15 @@ static uint32_t zend_version_info_length;
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 zend_result (*zend_stream_open_function)(const char *filename, zend_file_handle *handle);
+ZEND_API FILE *(*zend_fopen)(zend_string *filename, zend_string **opened_path);
+ZEND_API zend_result (*zend_stream_open_function)(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);
void (*zend_printf_to_smart_string)(smart_string *buf, const char *format, va_list ap);
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 zend_string *(*zend_resolve_path)(zend_string *filename);
ZEND_API zend_result (*zend_post_startup_cb)(void) = NULL;
ZEND_API void (*zend_post_shutdown_cb)(void) = NULL;
ZEND_API zend_result (*zend_preload_autoload)(zend_string *filename) = NULL;
@@ -515,12 +515,12 @@ ZEND_API void zend_print_zval_r(zval *expr, int indent) /* {{{ */
}
/* }}} */
-static FILE *zend_fopen_wrapper(const char *filename, zend_string **opened_path) /* {{{ */
+static FILE *zend_fopen_wrapper(zend_string *filename, zend_string **opened_path) /* {{{ */
{
if (opened_path) {
- *opened_path = zend_string_init(filename, strlen(filename), 0);
+ *opened_path = zend_string_copy(filename);
}
- return fopen(filename, "rb");
+ return fopen(ZSTR_VAL(filename), "rb");
}
/* }}} */
@@ -1674,9 +1674,6 @@ ZEND_API zend_result zend_execute_scripts(int type, zval *retval, int file_count
}
if (ret == FAILURE) {
- /* If a failure occurred in one of the earlier files,
- * only destroy the following file handles. */
- zend_file_handle_dtor(file_handle);
continue;
}
@@ -1684,7 +1681,6 @@ ZEND_API zend_result zend_execute_scripts(int type, zval *retval, int file_count
if (file_handle->opened_path) {
zend_hash_add_empty_element(&EG(included_files), file_handle->opened_path);
}
- zend_destroy_file_handle(file_handle);
if (op_array) {
zend_execute(op_array, retval);
zend_exception_restore();
diff --git a/Zend/zend.h b/Zend/zend.h
index 44f3baac46..e09884941c 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -215,16 +215,16 @@ typedef struct _zend_utility_functions {
void (*error_function)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message);
size_t (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
size_t (*write_function)(const char *str, size_t str_length);
- FILE *(*fopen_function)(const char *filename, zend_string **opened_path);
+ FILE *(*fopen_function)(zend_string *filename, zend_string **opened_path);
void (*message_handler)(zend_long message, const void *data);
zval *(*get_configuration_directive)(zend_string *name);
void (*ticks_function)(int ticks);
void (*on_timeout)(int seconds);
- zend_result (*stream_open_function)(const char *filename, zend_file_handle *handle);
+ zend_result (*stream_open_function)(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);
- zend_string *(*resolve_path_function)(const char *filename, size_t filename_len);
+ zend_string *(*resolve_path_function)(zend_string *filename);
} zend_utility_functions;
typedef struct _zend_utility_values {
@@ -303,16 +303,16 @@ END_EXTERN_C()
BEGIN_EXTERN_C()
extern ZEND_API size_t (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
extern ZEND_API zend_write_func_t zend_write;
-extern ZEND_API FILE *(*zend_fopen)(const char *filename, zend_string **opened_path);
+extern ZEND_API FILE *(*zend_fopen)(zend_string *filename, zend_string **opened_path);
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 zend_result (*zend_stream_open_function)(const char *filename, zend_file_handle *handle);
+extern ZEND_API zend_result (*zend_stream_open_function)(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);
+extern ZEND_API zend_string *(*zend_resolve_path)(zend_string *filename);
/* These two callbacks are especially for opcache */
extern ZEND_API zend_result (*zend_post_startup_cb)(void);
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index deff0dbe57..d6b3075357 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -398,13 +398,6 @@ static bool zend_have_seen_symbol(zend_string *name, uint32_t kind) {
return zv && (Z_LVAL_P(zv) & kind) != 0;
}
-ZEND_API void file_handle_dtor(zend_file_handle *fh) /* {{{ */
-{
-
- zend_file_handle_dtor(fh);
-}
-/* }}} */
-
void init_compiler(void) /* {{{ */
{
CG(arena) = zend_arena_create(64 * 1024);
@@ -412,7 +405,7 @@ void init_compiler(void) /* {{{ */
memset(&CG(context), 0, sizeof(CG(context)));
zend_init_compiler_data_structures();
zend_init_rsrc_list();
- zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) file_handle_dtor, 0);
+ zend_stream_init();
CG(unclean_shutdown) = 0;
CG(delayed_variance_obligations) = NULL;
diff --git a/Zend/zend_dtrace.c b/Zend/zend_dtrace.c
index 935421121e..cce810c177 100644
--- a/Zend/zend_dtrace.c
+++ b/Zend/zend_dtrace.c
@@ -44,9 +44,9 @@ static inline const char *dtrace_get_executed_filename(void)
ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type)
{
zend_op_array *res;
- DTRACE_COMPILE_FILE_ENTRY(ZSTR_VAL(file_handle->opened_path), (char *)file_handle->filename);
+ DTRACE_COMPILE_FILE_ENTRY(ZSTR_VAL(file_handle->opened_path), ZSTR_VAL(file_handle->filename));
res = compile_file(file_handle, type);
- DTRACE_COMPILE_FILE_RETURN(ZSTR_VAL(file_handle->opened_path), (char *)file_handle->filename);
+ DTRACE_COMPILE_FILE_RETURN(ZSTR_VAL(file_handle->opened_path), ZSTR_VAL(file_handle->filename));
return res;
}
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index ce2901d52c..9f69041257 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -4222,10 +4222,12 @@ static zend_never_inline zend_op_array* ZEND_FASTCALL zend_include_or_eval(zval
zend_file_handle file_handle;
zend_string *resolved_path;
- resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename));
+ resolved_path = zend_resolve_path(Z_STR_P(inc_filename));
if (EXPECTED(resolved_path)) {
if (zend_hash_exists(&EG(included_files), resolved_path)) {
- goto already_compiled;
+ new_op_array = ZEND_FAKE_OP_ARRAY;
+ zend_string_release_ex(resolved_path, 0);
+ break;
}
} else if (UNEXPECTED(EG(exception))) {
break;
@@ -4239,7 +4241,8 @@ static zend_never_inline zend_op_array* ZEND_FASTCALL zend_include_or_eval(zval
resolved_path = zend_string_copy(Z_STR_P(inc_filename));
}
- if (SUCCESS == zend_stream_open(ZSTR_VAL(resolved_path), &file_handle)) {
+ zend_stream_init_filename_ex(&file_handle, resolved_path);
+ if (SUCCESS == zend_stream_open(&file_handle)) {
if (!file_handle.opened_path) {
file_handle.opened_path = zend_string_copy(resolved_path);
@@ -4254,8 +4257,6 @@ static zend_never_inline zend_op_array* ZEND_FASTCALL zend_include_or_eval(zval
}
return op_array;
} else {
- zend_file_handle_dtor(&file_handle);
-already_compiled:
new_op_array = ZEND_FAKE_OP_ARRAY;
}
} else if (!EG(exception)) {
@@ -4264,6 +4265,7 @@ already_compiled:
ZMSG_FAILED_INCLUDE_FOPEN : ZMSG_FAILED_REQUIRE_FOPEN,
Z_STRVAL_P(inc_filename));
}
+ zend_destroy_file_handle(&file_handle);
zend_string_release_ex(resolved_path, 0);
}
break;
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 4e8c1d5a1f..f61a865ddc 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -264,7 +264,7 @@ void shutdown_executor(void) /* {{{ */
#endif
zend_try {
- zend_llist_destroy(&CG(open_files));
+ zend_stream_shutdown();
} zend_end_try();
EG(flags) |= EG_FLAGS_IN_RESOURCE_SHUTDOWN;
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index e9b24fc0e3..6ea35f3f36 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -270,7 +270,7 @@ struct _zend_ini_scanner_globals {
int yy_state;
zend_stack state_stack;
- char *filename;
+ zend_string *filename;
int lineno;
/* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW, ZEND_INI_SCANNER_TYPED */
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y
index 6d9dd09e34..7eb3753520 100644
--- a/Zend/zend_ini_parser.y
+++ b/Zend/zend_ini_parser.y
@@ -227,7 +227,6 @@ ZEND_API zend_result zend_parse_ini_file(zend_file_handle *fh, bool unbuffered_e
CG(ini_parser_unbuffered_errors) = unbuffered_errors;
retval = ini_parse();
- zend_file_handle_dtor(fh);
shutdown_ini_scanner();
diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index 1d689f3748..b75387714d 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -231,7 +231,7 @@ static zend_result init_ini_scanner(int scanner_mode, zend_file_handle *fh)
SCNG(yy_in) = fh;
if (fh != NULL) {
- ini_filename = zend_strndup(fh->filename, strlen(fh->filename));
+ ini_filename = zend_string_copy(fh->filename);
} else {
ini_filename = NULL;
}
@@ -248,7 +248,7 @@ void shutdown_ini_scanner(void)
{
zend_stack_destroy(&SCNG(state_stack));
if (ini_filename) {
- free(ini_filename);
+ zend_string_release(ini_filename);
}
}
/* }}} */
@@ -263,7 +263,7 @@ ZEND_COLD int zend_ini_scanner_get_lineno(void)
/* {{{ zend_ini_scanner_get_filename() */
ZEND_COLD char *zend_ini_scanner_get_filename(void)
{
- return ini_filename ? ini_filename : "Unknown";
+ return ini_filename ? ZSTR_VAL(ini_filename) : "Unknown";
}
/* }}} */
@@ -278,7 +278,6 @@ zend_result zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mo
}
if (init_ini_scanner(scanner_mode, fh) == FAILURE) {
- zend_file_handle_dtor(fh);
return FAILURE;
}
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index c639fa3209..02714b4e1f 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -297,16 +297,6 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state)
RESET_DOC_COMMENT();
}
-ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle)
-{
- zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles);
- /* zend_file_handle_dtor() operates on the copy, so we have to NULLify the original here */
- file_handle->opened_path = NULL;
- if (file_handle->free_filename) {
- file_handle->filename = NULL;
- }
-}
-
ZEND_API zend_result zend_lex_tstring(zval *zv, unsigned char *ident)
{
unsigned char *end = ident;
@@ -542,11 +532,13 @@ ZEND_API zend_result open_file_for_scanning(zend_file_handle *file_handle)
if (zend_stream_fixup(file_handle, &buf, &size) == FAILURE) {
/* Still add it to open_files to make destroy_file_handle work */
zend_llist_add_element(&CG(open_files), file_handle);
+ file_handle->in_list = 1;
return FAILURE;
}
ZEND_ASSERT(!EG(exception) && "stream_fixup() should have failed");
zend_llist_add_element(&CG(open_files), file_handle);
+ file_handle->in_list = 1;
/* Reset the scanner for scanning the new file */
SCNG(yy_in) = file_handle;
@@ -584,7 +576,7 @@ ZEND_API zend_result open_file_for_scanning(zend_file_handle *file_handle)
if (file_handle->opened_path) {
compiled_filename = zend_string_copy(file_handle->opened_path);
} else {
- compiled_filename = zend_string_init(file_handle->filename, strlen(file_handle->filename), 0);
+ compiled_filename = zend_string_copy(file_handle->filename);
}
zend_set_compiled_filename(compiled_filename);
@@ -655,9 +647,9 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type)
if (open_file_for_scanning(file_handle)==FAILURE) {
if (!EG(exception)) {
if (type==ZEND_REQUIRE) {
- zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
+ zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, ZSTR_VAL(file_handle->filename));
} else {
- zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
+ zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, ZSTR_VAL(file_handle->filename));
}
}
} else {
@@ -715,7 +707,7 @@ zend_op_array *compile_filename(int type, zval *filename)
ZVAL_STR(&tmp, zval_get_string(filename));
filename = &tmp;
}
- zend_stream_init_filename(&file_handle, Z_STRVAL_P(filename));
+ zend_stream_init_filename_ex(&file_handle, Z_STR_P(filename));
retval = zend_compile_file(&file_handle, type);
if (retval && file_handle.handle.stream.handle) {
@@ -837,6 +829,7 @@ zend_result highlight_file(const char *filename, zend_syntax_highlighter_ini *sy
zend_save_lexical_state(&original_lex_state);
if (open_file_for_scanning(&file_handle)==FAILURE) {
zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename);
+ zend_destroy_file_handle(&file_handle);
zend_restore_lexical_state(&original_lex_state);
return FAILURE;
}
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c
index 78a3310438..8c42b2494e 100644
--- a/Zend/zend_llist.c
+++ b/Zend/zend_llist.c
@@ -112,6 +112,8 @@ ZEND_API void zend_llist_destroy(zend_llist *l)
current = next;
}
+ l->head = NULL;
+ l->tail = NULL;
l->count = 0;
}
diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c
index 1dfc5b1bc1..aadc62558e 100644
--- a/Zend/zend_stream.c
+++ b/Zend/zend_stream.c
@@ -64,25 +64,36 @@ ZEND_API void zend_stream_init_fp(zend_file_handle *handle, FILE *fp, const char
memset(handle, 0, sizeof(zend_file_handle));
handle->type = ZEND_HANDLE_FP;
handle->handle.fp = fp;
- handle->filename = filename;
+ handle->filename = filename ? zend_string_init(filename, strlen(filename), 0) : NULL;
}
ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *filename) {
memset(handle, 0, sizeof(zend_file_handle));
handle->type = ZEND_HANDLE_FILENAME;
- handle->filename = filename;
+ handle->filename = filename ? zend_string_init(filename, strlen(filename), 0) : NULL;
}
-ZEND_API zend_result zend_stream_open(const char *filename, zend_file_handle *handle) /* {{{ */
+ZEND_API void zend_stream_init_filename_ex(zend_file_handle *handle, zend_string *filename) {
+ memset(handle, 0, sizeof(zend_file_handle));
+ handle->type = ZEND_HANDLE_FILENAME;
+ handle->filename = zend_string_copy(filename);
+}
+
+ZEND_API zend_result zend_stream_open(zend_file_handle *handle) /* {{{ */
{
zend_string *opened_path;
+
+ ZEND_ASSERT(handle->type == ZEND_HANDLE_FILENAME);
if (zend_stream_open_function) {
- return zend_stream_open_function(filename, handle);
+ return zend_stream_open_function(handle);
}
- zend_stream_init_fp(handle, zend_fopen(filename, &opened_path), filename);
- handle->opened_path = opened_path;
- return handle->handle.fp ? SUCCESS : FAILURE;
+ handle->handle.fp = zend_fopen(handle->filename, &opened_path);
+ if (!handle->handle.fp) {
+ return FAILURE;
+ }
+ handle->type = ZEND_HANDLE_FP;
+ return SUCCESS;
} /* }}} */
static int zend_stream_getc(zend_file_handle *file_handle) /* {{{ */
@@ -124,7 +135,7 @@ ZEND_API zend_result zend_stream_fixup(zend_file_handle *file_handle, char **buf
}
if (file_handle->type == ZEND_HANDLE_FILENAME) {
- if (zend_stream_open(file_handle->filename, file_handle) == FAILURE) {
+ if (zend_stream_open(file_handle) == FAILURE) {
return FAILURE;
}
}
@@ -199,7 +210,7 @@ ZEND_API zend_result zend_stream_fixup(zend_file_handle *file_handle, char **buf
return SUCCESS;
} /* }}} */
-ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */
+static void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */
{
switch (fh->type) {
case ZEND_HANDLE_FP:
@@ -225,22 +236,22 @@ ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */
efree(fh->buf);
fh->buf = NULL;
}
- if (fh->free_filename && fh->filename) {
- efree((char*)fh->filename);
+ if (fh->filename) {
+ zend_string_release(fh->filename);
fh->filename = NULL;
}
}
/* }}} */
/* 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) /* {{{ */
+static int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2) /* {{{ */
{
if (fh1->type != fh2->type) {
return 0;
}
switch (fh1->type) {
case ZEND_HANDLE_FILENAME:
- return strcmp(fh1->filename, fh2->filename) == 0;
+ return zend_string_equals(fh1->filename, fh2->filename);
case ZEND_HANDLE_FP:
return fh1->handle.fp == fh2->handle.fp;
case ZEND_HANDLE_STREAM:
@@ -250,3 +261,25 @@ ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *
}
return 0;
} /* }}} */
+
+ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle) /* {{{ */
+{
+ if (file_handle->in_list) {
+ zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles);
+ /* zend_file_handle_dtor() operates on the copy, so we have to NULLify the original here */
+ file_handle->opened_path = NULL;
+ file_handle->filename = NULL;
+ } else {
+ zend_file_handle_dtor(file_handle);
+ }
+} /* }}} */
+
+void zend_stream_init(void) /* {{{ */
+{
+ zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) zend_file_handle_dtor, 0);
+} /* }}} */
+
+void zend_stream_shutdown(void) /* {{{ */
+{
+ zend_llist_destroy(&CG(open_files));
+} /* }}} */
diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h
index e97a796730..047719e175 100644
--- a/Zend/zend_stream.h
+++ b/Zend/zend_stream.h
@@ -53,12 +53,11 @@ typedef struct _zend_file_handle {
FILE *fp;
zend_stream stream;
} handle;
- const char *filename;
+ zend_string *filename;
zend_string *opened_path;
- zend_stream_type type;
- /* free_filename is used by wincache */
- /* TODO: Clean up filename vs opened_path mess */
- bool free_filename;
+ zend_uchar type; /* packed zend_stream_type */
+ bool primary_script;
+ bool in_list; /* added into CG(open_file) */
char *buf;
size_t len;
} zend_file_handle;
@@ -66,10 +65,13 @@ 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 zend_result zend_stream_open(const char *filename, zend_file_handle *handle);
+ZEND_API void zend_stream_init_filename_ex(zend_file_handle *handle, zend_string *filename);
+ZEND_API zend_result zend_stream_open(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);
+ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle);
+
+void zend_stream_init(void);
+void zend_stream_shutdown(void);
END_EXTERN_C()
#ifdef ZEND_WIN32