[dovecot-cvs] dovecot/src/lib buffer.c, 1.26, 1.27 buffer.h, 1.13, 1.14

cras at dovecot.org cras at dovecot.org
Sat Apr 2 22:29:11 EEST 2005


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

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



Index: buffer.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/buffer.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- buffer.c	27 Mar 2005 13:51:54 -0000	1.26
+++ buffer.c	2 Apr 2005 19:29:08 -0000	1.27
@@ -281,3 +281,11 @@
 
 	return buf->alloc;
 }
+
+int buffer_cmp(const buffer_t *buf1, const buffer_t *buf2)
+{
+	if (buf1->used != buf2->used)
+		return FALSE;
+
+	return memcmp(buf1->data, buf2->data, buf1->used) == 0;
+}

Index: buffer.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/buffer.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- buffer.h	12 Mar 2005 12:24:28 -0000	1.13
+++ buffer.h	2 Apr 2005 19:29:08 -0000	1.14
@@ -79,6 +79,9 @@
 /* Returns the current buffer size. */
 size_t buffer_get_size(const buffer_t *buf);
 
+/* Returns TRUE if buffer contents are identical. */
+int buffer_cmp(const buffer_t *buf1, const buffer_t *buf2);
+
 /* Returns pointer to beginning of buffer data. Current used size of buffer is
    stored in used_size if it's non-NULL. */
 static inline const void *



More information about the dovecot-cvs mailing list