dovecot: If all streams are seekable, return a concat stream ins...

dovecot at dovecot.org dovecot at dovecot.org
Sat Oct 20 20:45:09 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/717fdce1cfb4
changeset: 6568:717fdce1cfb4
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Oct 20 20:45:05 2007 +0300
description:
If all streams are seekable, return a concat stream instead.

diffstat:

1 file changed, 9 insertions(+)
src/lib/istream-seekable.c |    9 +++++++++

diffs (26 lines):

diff -r b8442b2e3c04 -r 717fdce1cfb4 src/lib/istream-seekable.c
--- 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 @@ i_stream_create_seekable(struct istream 
 	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)


More information about the dovecot-cvs mailing list