dovecot: If iostream.close/destroy isn't set by the stream imple...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Sep 16 13:53:19 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/3a960ffa5de8
changeset: 6419:3a960ffa5de8
user: Timo Sirainen <tss at iki.fi>
date: Sun Sep 16 12:51:41 2007 +0300
description:
If iostream.close/destroy isn't set by the stream implementation, use a
default no-op function.
diffstat:
6 files changed, 10 insertions(+), 31 deletions(-)
src/lib-mail/istream-header-filter.c | 5 -----
src/lib-storage/index/mbox/istream-raw-mbox.c | 5 -----
src/lib/iostream.c | 10 ++++++++++
src/lib/istream-data.c | 11 -----------
src/lib/istream-limit.c | 5 -----
src/lib/ostream-crlf.c | 5 -----
diffs (138 lines):
diff -r 46d9ee79f292 -r 3a960ffa5de8 src/lib-mail/istream-header-filter.c
--- a/src/lib-mail/istream-header-filter.c Sun Sep 16 12:43:21 2007 +0300
+++ b/src/lib-mail/istream-header-filter.c Sun Sep 16 12:51:41 2007 +0300
@@ -36,10 +36,6 @@ struct header_filter_istream {
};
header_filter_callback *null_header_filter_callback = NULL;
-
-static void _close(struct iostream_private *stream ATTR_UNUSED)
-{
-}
static void _destroy(struct iostream_private *stream)
{
@@ -354,7 +350,6 @@ i_stream_create_header_filter(struct ist
mstream->hide_body = (flags & HEADER_FILTER_HIDE_BODY) != 0;
mstream->start_offset = input->v_offset;
- mstream->istream.iostream.close = _close;
mstream->istream.iostream.destroy = _destroy;
mstream->istream.iostream.set_max_buffer_size = _set_max_buffer_size;
diff -r 46d9ee79f292 -r 3a960ffa5de8 src/lib-storage/index/mbox/istream-raw-mbox.c
--- a/src/lib-storage/index/mbox/istream-raw-mbox.c Sun Sep 16 12:43:21 2007 +0300
+++ b/src/lib-storage/index/mbox/istream-raw-mbox.c Sun Sep 16 12:51:41 2007 +0300
@@ -21,10 +21,6 @@ struct raw_mbox_istream {
unsigned int corrupted:1;
unsigned int eof:1;
};
-
-static void _close(struct iostream_private *stream ATTR_UNUSED)
-{
-}
static void _destroy(struct iostream_private *stream)
{
@@ -360,7 +356,6 @@ struct istream *i_stream_create_raw_mbox
rstream->received_time = (time_t)-1;
rstream->next_received_time = (time_t)-1;
- rstream->istream.iostream.close = _close;
rstream->istream.iostream.destroy = _destroy;
rstream->istream.iostream.set_max_buffer_size = _set_max_buffer_size;
diff -r 46d9ee79f292 -r 3a960ffa5de8 src/lib/iostream.c
--- a/src/lib/iostream.c Sun Sep 16 12:43:21 2007 +0300
+++ b/src/lib/iostream.c Sun Sep 16 12:51:41 2007 +0300
@@ -3,8 +3,18 @@
#include "lib.h"
#include "iostream-internal.h"
+static void
+io_stream_default_close_destroy(struct iostream_private *stream ATTR_UNUSED)
+{
+}
+
void io_stream_init(struct iostream_private *stream)
{
+ if (stream->close == NULL)
+ stream->close = io_stream_default_close_destroy;
+ if (stream->destroy == NULL)
+ stream->destroy = io_stream_default_close_destroy;
+
stream->refcount = 1;
}
diff -r 46d9ee79f292 -r 3a960ffa5de8 src/lib/istream-data.c
--- a/src/lib/istream-data.c Sun Sep 16 12:43:21 2007 +0300
+++ b/src/lib/istream-data.c Sun Sep 16 12:51:41 2007 +0300
@@ -2,14 +2,6 @@
#include "lib.h"
#include "istream-internal.h"
-
-static void _close(struct iostream_private *stream ATTR_UNUSED)
-{
-}
-
-static void _destroy(struct iostream_private *stream ATTR_UNUSED)
-{
-}
static ssize_t _read(struct istream_private *stream ATTR_UNUSED)
{
@@ -32,9 +24,6 @@ struct istream *i_stream_create_from_dat
stream->buffer = data;
stream->pos = size;
- stream->iostream.close = _close;
- stream->iostream.destroy = _destroy;
-
stream->read = _read;
stream->seek = _seek;
diff -r 46d9ee79f292 -r 3a960ffa5de8 src/lib/istream-limit.c
--- a/src/lib/istream-limit.c Sun Sep 16 12:43:21 2007 +0300
+++ b/src/lib/istream-limit.c Sun Sep 16 12:51:41 2007 +0300
@@ -9,10 +9,6 @@ struct limit_istream {
struct istream *input;
uoff_t v_start_offset, v_size;
};
-
-static void _close(struct iostream_private *stream ATTR_UNUSED)
-{
-}
static void _destroy(struct iostream_private *stream)
{
@@ -126,7 +122,6 @@ struct istream *i_stream_create_limit(st
input->v_offset - v_start_offset > v_size ? v_size :
input->v_offset - v_start_offset;
- lstream->istream.iostream.close = _close;
lstream->istream.iostream.destroy = _destroy;
lstream->istream.iostream.set_max_buffer_size = _set_max_buffer_size;
diff -r 46d9ee79f292 -r 3a960ffa5de8 src/lib/ostream-crlf.c
--- a/src/lib/ostream-crlf.c Sun Sep 16 12:43:21 2007 +0300
+++ b/src/lib/ostream-crlf.c Sun Sep 16 12:51:41 2007 +0300
@@ -19,10 +19,6 @@ struct crlf_ostream {
};
static const struct const_iovec cr_iov = { "\r", 1 };
-
-static void _close(struct iostream_private *stream ATTR_UNUSED)
-{
-}
static void _destroy(struct iostream_private *stream)
{
@@ -356,7 +352,6 @@ static struct crlf_ostream *o_stream_cre
cstream->output = output;
o_stream_ref(output);
- cstream->ostream.iostream.close = _close;
cstream->ostream.iostream.destroy = _destroy;
cstream->ostream.iostream.set_max_buffer_size = _set_max_buffer_size;
More information about the dovecot-cvs
mailing list