]> granicus.if.org Git - php/commitdiff
Attempt to eliminate seek() prior to every write.
authorIlia Alshanetsky <iliaa@php.net>
Fri, 29 Apr 2005 19:01:33 +0000 (19:01 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 29 Apr 2005 19:01:33 +0000 (19:01 +0000)
main/streams/streams.c

index 68ce4f0a76f299ae62d3c51d02e4ec971d5d7d60..3729eaf74e3fd831f127e80c5ce33df7fe7bb58b 100755 (executable)
@@ -892,7 +892,7 @@ static size_t _php_stream_write_buffer(php_stream *stream, const char *buf, size
        /* if we have a seekable stream we need to ensure that data is written at the
         * current stream->position. This means invalidating the read buffer and then
         * performing a low-level seek */
-       if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) {
+       if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0 && stream->readpos != stream->writepos) {
                stream->readpos = stream->writepos = 0;
 
                stream->ops->seek(stream, stream->position, SEEK_SET, &stream->position TSRMLS_CC);