summaryrefslogtreecommitdiff
path: root/Zend/zend_stream.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-07-16 16:21:45 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-07-16 16:44:37 +0200
commit46faf8f018e95de27873dbcf7c094af18c4c08e4 (patch)
treeedd85291c8c8070f3182617152098c9289242e6e /Zend/zend_stream.c
parent349a388b90e767da9128efe6da0e4ebf5c752092 (diff)
downloadphp-git-46faf8f018e95de27873dbcf7c094af18c4c08e4.tar.gz
Introduce zend_stream_init_fp() API
Reduce the amount of code that mucks around with zend_file_handle initialization.
Diffstat (limited to 'Zend/zend_stream.c')
-rw-r--r--Zend/zend_stream.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c
index 110ac805cf..fc0523ee96 100644
--- a/Zend/zend_stream.c
+++ b/Zend/zend_stream.c
@@ -94,6 +94,13 @@ static size_t zend_stream_fsize(zend_file_handle *file_handle) /* {{{ */
return -1;
} /* }}} */
+ZEND_API void zend_stream_init_fp(zend_file_handle *handle, FILE *fp, const char *filename) {
+ memset(handle, 0, sizeof(zend_file_handle));
+ handle->type = ZEND_HANDLE_FP;
+ handle->handle.fp = fp;
+ handle->filename = filename;
+}
+
ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle) /* {{{ */
{
if (zend_stream_open_function) {