Skip to content

Commit 06896d1

Browse files
committed
Improve locality of stream variable
1 parent 96ffdd4 commit 06896d1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ext/phar/func_interceptors.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
156156
zend_string *filename;
157157
zend_string *contents;
158158
bool use_include_path = 0;
159-
php_stream *stream;
160159
zend_long offset = -1;
161160
zend_long maxlen;
162161
bool maxlen_is_null = 1;
@@ -190,6 +189,8 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
190189
}
191190

192191
php_stream_context *context = NULL;
192+
php_stream *stream;
193+
193194
if (zcontext) {
194195
context = php_stream_context_from_zval(zcontext, 0);
195196
}
@@ -232,7 +233,6 @@ PHAR_FUNC(phar_readfile) /* {{{ */
232233
zend_string *filename;
233234
bool use_include_path = 0;
234235
zval *zcontext = NULL;
235-
php_stream *stream;
236236

237237
if (!PHAR_G(intercepted)) {
238238
goto skip_phar;
@@ -251,7 +251,9 @@ PHAR_FUNC(phar_readfile) /* {{{ */
251251
goto skip_phar;
252252
}
253253

254-
php_stream_context *context = php_stream_context_from_zval(zcontext, 0);;
254+
php_stream *stream;
255+
php_stream_context *context = php_stream_context_from_zval(zcontext, 0);
256+
255257
stream = php_stream_open_wrapper_ex(ZSTR_VAL(name), "rb", 0 | REPORT_ERRORS, NULL, context);
256258

257259
zend_string_release_ex(name, false);
@@ -277,7 +279,6 @@ PHAR_FUNC(phar_fopen) /* {{{ */
277279
size_t mode_len;
278280
bool use_include_path = 0;
279281
zval *zcontext = NULL;
280-
php_stream *stream;
281282

282283
if (!PHAR_G(intercepted)) {
283284
goto skip_phar;
@@ -297,7 +298,9 @@ PHAR_FUNC(phar_fopen) /* {{{ */
297298
goto skip_phar;
298299
}
299300

301+
php_stream *stream;
300302
php_stream_context *context = php_stream_context_from_zval(zcontext, 0);
303+
301304
stream = php_stream_open_wrapper_ex(ZSTR_VAL(name), mode, 0 | REPORT_ERRORS, NULL, context);
302305

303306
zend_string_release_ex(name, false);

0 commit comments

Comments
 (0)