changeset 6568:717fdce1cfb4 HEAD

If all streams are seekable, return a concat stream instead.
author Timo Sirainen <tss@iki.fi>
date Sat, 20 Oct 2007 20:45:05 +0300
parents b8442b2e3c04
children b7d8695d864d
files src/lib/istream-seekable.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/istream-seekable.c	Sat Oct 20 20:33:12 2007 +0300
+++ b/src/lib/istream-seekable.c	Sat Oct 20 20:45:05 2007 +0300
@@ -6,6 +6,7 @@
 #include "randgen.h"
 #include "write-full.h"
 #include "istream-internal.h"
+#include "istream-concat.h"
 #include "istream-seekable.h"
 
 #include <sys/stat.h>
@@ -303,6 +304,14 @@
 	size_t size;
 	bool blocking = TRUE;
 
+	/* If all input streams are seekable, use concat istream instead */
+	for (count = 0; input[count] != NULL; count++) {
+		if (!input[count]->seekable)
+			break;
+	}
+	if (input[count] == NULL)
+		return i_stream_create_concat(input);
+
 	/* if any of the streams isn't blocking, set ourself also nonblocking */
 	for (count = 0; input[count] != NULL; count++) {
 		if (!input[count]->blocking)