[dovecot-cvs] dovecot/src/lib istream.c,1.6,1.7 istream.h,1.6,1.7

cras at procontrol.fi cras at procontrol.fi
Mon Mar 10 02:36:11 EET 2003


Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv29409/lib

Modified Files:
	istream.c istream.h 
Log Message:
Added i_stream_read_next_line()



Index: istream.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- istream.c	23 Jan 2003 19:08:53 -0000	1.6
+++ istream.c	10 Mar 2003 00:36:08 -0000	1.7
@@ -189,6 +189,19 @@
         return ret_buf;
 }
 
+char *i_stream_read_next_line(struct istream *stream)
+{
+	char *line;
+
+	line = i_stream_next_line(stream);
+	if (line != NULL)
+		return line;
+
+	if (i_stream_read(stream) > 0)
+		line = i_stream_next_line(stream);
+	return line;
+}
+
 const unsigned char *i_stream_get_data(struct istream *stream, size_t *size)
 {
 	struct _istream *_stream = stream->real_stream;

Index: istream.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- istream.h	19 Feb 2003 19:50:22 -0000	1.6
+++ istream.h	10 Mar 2003 00:36:08 -0000	1.7
@@ -57,10 +57,13 @@
 /* Seek to specified position from beginning of file. Never fails, the next
    read tells if it was successful. This works only for files. */
 void i_stream_seek(struct istream *stream, uoff_t v_offset);
-/* Reads the next line from stream and returns it, or NULL if more data is
+/* Gets the next line from stream and returns it, or NULL if more data is
    needed to make a full line. NOTE: modifies the data in buffer for the \0,
    so it works only with buffered streams (currently only file). */
 char *i_stream_next_line(struct istream *stream);
+/* Like i_stream_next_line(), but reads for more data if needed. Returns NULL
+   if more data is needed or error occured. */
+char *i_stream_read_next_line(struct istream *stream);
 /* Returns pointer to beginning of read data, or NULL if there's no data
    buffered. */
 const unsigned char *i_stream_get_data(struct istream *stream, size_t *size);




More information about the dovecot-cvs mailing list