[dovecot-cvs] dovecot/src/lib istream-file.c,1.4,1.5 istream-internal.h,1.2,1.3 istream.c,1.3,1.4

cras at procontrol.fi cras at procontrol.fi
Tue Jan 7 19:44:26 EET 2003


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

Modified Files:
	istream-file.c istream-internal.h istream.c 
Log Message:
Removed cr_lookup_pos optimization with i_stream_next_line(). It breaks if
the stream is used with anything else and it's probably not worth fixing.



Index: istream-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-file.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- istream-file.c	5 Jan 2003 13:09:51 -0000	1.4
+++ istream-file.c	7 Jan 2003 17:44:23 -0000	1.5
@@ -118,11 +118,6 @@
 		stream->pos - stream->skip);
 	stream->pos -= stream->skip;
 
-	if (stream->skip > stream->cr_lookup_pos)
-		stream->cr_lookup_pos = 0;
-	else
-		stream->cr_lookup_pos -= stream->skip;
-
 	stream->skip = 0;
 }
 

Index: istream-internal.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-internal.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- istream-internal.h	5 Jan 2003 13:09:51 -0000	1.2
+++ istream-internal.h	7 Jan 2003 17:44:23 -0000	1.3
@@ -21,7 +21,7 @@
 	unsigned char *w_buffer; /* may be NULL */
 	size_t buffer_size;
 
-	size_t skip, pos, cr_lookup_pos;
+	size_t skip, pos;
 };
 
 struct istream *_i_stream_create(struct _istream *_buf, pool_t pool, int fd,

Index: istream.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- istream.c	5 Jan 2003 13:09:51 -0000	1.3
+++ istream.c	7 Jan 2003 17:44:23 -0000	1.4
@@ -81,7 +81,7 @@
 	}
 
 	/* reset buffer data */
-	_stream->skip = _stream->pos = _stream->cr_lookup_pos = 0;
+	_stream->skip = _stream->pos = 0;
 }
 
 void i_stream_set_read_limit(struct istream *stream, uoff_t v_offset)
@@ -169,7 +169,7 @@
 
 	/* @UNSAFE */
 	ret_buf = NULL;
-	for (i = _stream->cr_lookup_pos; i < _stream->pos; i++) {
+	for (i = _stream->skip; i < _stream->pos; i++) {
 		if (_stream->buffer[i] == 10) {
 			/* got it */
 			if (i > 0 && _stream->buffer[i-1] == '\r')
@@ -185,7 +185,6 @@
 		}
 	}
 
-	_stream->cr_lookup_pos = i;
         return ret_buf;
 }
 




More information about the dovecot-cvs mailing list