[dovecot-cvs] dovecot/src/lib buffer.c, 1.27, 1.28 buffer.h, 1.15, 1.16

cras at dovecot.org cras at dovecot.org
Thu Jun 30 23:30:08 EEST 2005


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

Modified Files:
	buffer.c buffer.h 
Log Message:
Added buffer_update_const_data().



Index: buffer.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/buffer.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- buffer.c	2 Apr 2005 19:29:08 -0000	1.27
+++ buffer.c	30 Jun 2005 20:30:06 -0000	1.28
@@ -89,9 +89,17 @@
 
 	buf = p_new(pool, struct real_buffer, 1);
 	buf->pool = pool;
+	buffer_update_const_data((buffer_t *)buf, data, size);
+	return (buffer_t *)buf;
+}
+
+void buffer_update_const_data(buffer_t *_buf, const void *data, size_t size)
+{
+	struct real_buffer *buf = (struct real_buffer *)_buf;
+
 	buf->used = buf->alloc = size;
 	buf->r_buffer = data;
-	return (buffer_t *)buf;
+	i_assert(buf->w_buffer == NULL);
 }
 
 buffer_t *buffer_create_dynamic(pool_t pool, size_t init_size)

Index: buffer.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/buffer.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- buffer.h	16 Apr 2005 19:42:37 -0000	1.15
+++ buffer.h	30 Jun 2005 20:30:06 -0000	1.16
@@ -21,6 +21,7 @@
 buffer_t *buffer_create_data(pool_t pool, void *data, size_t size);
 /* Create a non-modifyable buffer from given data. */
 buffer_t *buffer_create_const_data(pool_t pool, const void *data, size_t size);
+void buffer_update_const_data(buffer_t *buffer, const void *data, size_t size);
 /* Creates a dynamically growing buffer. Whenever write would exceed the
    current size it's grown. */
 buffer_t *buffer_create_dynamic(pool_t pool, size_t init_size);



More information about the dovecot-cvs mailing list