Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6419:3a960ffa5de8 HEAD
If iostream.close/destroy isn't set by the stream implementation, use a
default no-op function.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 16 Sep 2007 12:51:41 +0300 |
parents | 46d9ee79f292 |
children | a8b515e1a26f |
files | src/lib-mail/istream-header-filter.c src/lib-storage/index/mbox/istream-raw-mbox.c src/lib/iostream.c src/lib/istream-data.c src/lib/istream-limit.c src/lib/ostream-crlf.c |
diffstat | 6 files changed, 10 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ -37,10 +37,6 @@ header_filter_callback *null_header_filter_callback = NULL; -static void _close(struct iostream_private *stream ATTR_UNUSED) -{ -} - static void _destroy(struct iostream_private *stream) { struct header_filter_istream *mstream = @@ -354,7 +350,6 @@ 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;
--- 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 @@ -22,10 +22,6 @@ unsigned int eof:1; }; -static void _close(struct iostream_private *stream ATTR_UNUSED) -{ -} - static void _destroy(struct iostream_private *stream) { struct raw_mbox_istream *rstream = (struct raw_mbox_istream *)stream; @@ -360,7 +356,6 @@ 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;
--- 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; }
--- 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 @@ -3,14 +3,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) { stream->istream.eof = TRUE; @@ -32,9 +24,6 @@ stream->buffer = data; stream->pos = size; - stream->iostream.close = _close; - stream->iostream.destroy = _destroy; - stream->read = _read; stream->seek = _seek;
--- 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 @@ -10,10 +10,6 @@ uoff_t v_start_offset, v_size; }; -static void _close(struct iostream_private *stream ATTR_UNUSED) -{ -} - static void _destroy(struct iostream_private *stream) { struct limit_istream *lstream = (struct limit_istream *) stream; @@ -126,7 +122,6 @@ 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;
--- 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 @@ -20,10 +20,6 @@ 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) { struct crlf_ostream *cstream = (struct crlf_ostream *)stream; @@ -356,7 +352,6 @@ 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;