From: Ilia Alshanetsky Date: Fri, 29 Apr 2005 19:01:33 +0000 (+0000) Subject: Attempt to eliminate seek() prior to every write. X-Git-Tag: php-5.0.1b1~368 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=edd486067482514f8e8f1998612a1c251ac34671;p=php Attempt to eliminate seek() prior to every write. --- diff --git a/main/streams/streams.c b/main/streams/streams.c index 68ce4f0a76..3729eaf74e 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -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);