Skip to content

Commit dc71fdf

Browse files
committed
Remove redundant code from _php_stream_copy_to_stream_ex()
The initialization is not necessary, and the function is already called in the if condition below.
1 parent 735b94a commit dc71fdf

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

main/streams/streams.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,14 +1563,12 @@ PHPAPI zend_result _php_stream_copy_to_stream_ex(php_stream *src, php_stream *de
15631563
src->writepos == src->readpos) {
15641564
/* both php_stream instances are backed by a file descriptor, are not filtered and the
15651565
* read buffer is empty: we can use copy_file_range() */
1566-
int src_fd, dest_fd, dest_open_flags = 0;
1567-
1568-
/* get dest open flags to check if the stream is open in append mode */
1569-
php_stream_parse_fopen_modes(dest->mode, &dest_open_flags);
1566+
int src_fd, dest_fd, dest_open_flags;
15701567

15711568
/* copy_file_range does not work with O_APPEND */
15721569
if (php_stream_cast(src, PHP_STREAM_AS_FD, (void*)&src_fd, 0) == SUCCESS &&
15731570
php_stream_cast(dest, PHP_STREAM_AS_FD, (void*)&dest_fd, 0) == SUCCESS &&
1571+
/* get dest open flags to check if the stream is open in append mode */
15741572
php_stream_parse_fopen_modes(dest->mode, &dest_open_flags) == SUCCESS &&
15751573
!(dest_open_flags & O_APPEND)) {
15761574

0 commit comments

Comments
 (0)