[dovecot-cvs] dovecot/src/lib istream.c, 1.33, 1.34 istream.h, 1.23, 1.24 ostream.c, 1.15, 1.16 ostream.h, 1.14, 1.15

cras at dovecot.org cras at dovecot.org
Sun Feb 26 12:05:09 EET 2006


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv5842/lib

Modified Files:
	istream.c istream.h ostream.c ostream.h 
Log Message:
Added i_stream_destroy() and o_stream_destroy() and used them instead of
*_stream_unref() where possible. Fixes at least one problem with io_remove()
being called after socket was closed, which caused problems with epoll.



Index: istream.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- istream.c	14 Jan 2006 18:47:22 -0000	1.33
+++ istream.c	26 Feb 2006 10:05:06 -0000	1.34
@@ -5,6 +5,12 @@
 #include "str.h"
 #include "istream-internal.h"
 
+void i_stream_destroy(struct istream **stream)
+{
+	i_stream_close(*stream);
+	i_stream_unref(stream);
+}
+
 void i_stream_ref(struct istream *stream)
 {
 	_io_stream_ref(&stream->real_stream->iostream);

Index: istream.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- istream.h	14 Jan 2006 18:47:22 -0000	1.23
+++ istream.h	26 Feb 2006 10:05:06 -0000	1.24
@@ -24,6 +24,9 @@
 struct istream *i_stream_create_limit(pool_t pool, struct istream *input,
 				      uoff_t v_start_offset, uoff_t v_size);
 
+/* i_stream_close() + i_stream_unref() */
+void i_stream_destroy(struct istream **stream);
+
 /* Reference counting. References start from 1, so calling i_stream_unref()
    destroys the stream if i_stream_ref() is never used. */
 void i_stream_ref(struct istream *stream);

Index: ostream.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ostream.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- ostream.c	14 Jan 2006 18:47:22 -0000	1.15
+++ ostream.c	26 Feb 2006 10:05:06 -0000	1.16
@@ -4,6 +4,12 @@
 #include "istream.h"
 #include "ostream-internal.h"
 
+void o_stream_destroy(struct ostream **stream)
+{
+	o_stream_close(*stream);
+	o_stream_unref(stream);
+}
+
 void o_stream_ref(struct ostream *stream)
 {
 	_io_stream_ref(&stream->real_stream->iostream);

Index: ostream.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ostream.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- ostream.h	14 Jan 2006 18:47:22 -0000	1.14
+++ ostream.h	26 Feb 2006 10:05:06 -0000	1.15
@@ -27,6 +27,8 @@
 o_stream_create_file(int fd, pool_t pool, size_t max_buffer_size,
 		     bool autoclose_fd);
 
+/* o_stream_close() + o_stream_unref() */
+void o_stream_destroy(struct ostream **stream);
 /* Reference counting. References start from 1, so calling o_stream_unref()
    destroys the stream if o_stream_ref() is never used. */
 void o_stream_ref(struct ostream *stream);



More information about the dovecot-cvs mailing list