[dovecot-cvs] dovecot/src/lib-index mail-index.c,1.78,1.79 mail-index.h,1.59,1.60

cras at procontrol.fi cras at procontrol.fi
Sat Jan 4 19:45:11 EET 2003


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

Modified Files:
	mail-index.c mail-index.h 
Log Message:
Replaced MailDataField from being enum to being unsigned int with values
defined with macros. Not that pretty, but enums are signed integers and we
want to use the highest bit without ugly kludges.



Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- mail-index.c	2 Jan 2003 11:29:24 -0000	1.78
+++ mail-index.c	4 Jan 2003 17:45:09 -0000	1.79
@@ -296,7 +296,8 @@
 	if (old_lock_type == MAIL_LOCK_SHARED) {
 		/* releasing shared lock. we may need to update some
 		   flags in header. */
-		unsigned int old_flags, old_cache;
+		unsigned int old_flags;
+		MailDataField old_cache;
 
 		old_flags = index->header->flags;
 		old_cache = index->header->cache_fields;

Index: mail-index.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- mail-index.h	2 Jan 2003 11:29:24 -0000	1.59
+++ mail-index.h	4 Jan 2003 17:45:09 -0000	1.60
@@ -26,23 +26,24 @@
 	MAIL_INDEX_FLAG_DIRTY_CUSTOMFLAGS	= 0x80
 };
 
-typedef enum {
-	DATA_FIELD_LOCATION		= 0x00000001,
-	DATA_FIELD_ENVELOPE		= 0x00000002,
-	DATA_FIELD_BODY			= 0x00000004,
-	DATA_FIELD_BODYSTRUCTURE	= 0x00000008,
-	DATA_FIELD_MD5			= 0x00000010,
-	DATA_FIELD_MESSAGEPART		= 0x00000020,
+/* Use macros instead of enum so highest bit can be used without kludging */
+#define DATA_FIELD_LOCATION		0x00000001
+#define DATA_FIELD_ENVELOPE		0x00000002
+#define DATA_FIELD_BODY			0x00000004
+#define DATA_FIELD_BODYSTRUCTURE	0x00000008
+#define DATA_FIELD_MD5			0x00000010
+#define DATA_FIELD_MESSAGEPART		0x00000020
 
-	DATA_FIELD_LAST			= 0x00000040,
-	DATA_FIELD_MAX_BITS		= 6,
+#define DATA_FIELD_LAST			0x00000040
+#define DATA_FIELD_MAX_BITS		6
 
-	/* separate from above, but in same bitmask */
-	DATA_HDR_INTERNAL_DATE		= 0x80000000,
-	DATA_HDR_VIRTUAL_SIZE		= 0x40000000,
-	DATA_HDR_HEADER_SIZE		= 0x20000000,
-	DATA_HDR_BODY_SIZE		= 0x10000000
-} MailDataField;
+/* separate from above, but in same bitmask */
+#define DATA_HDR_INTERNAL_DATE		0x80000000
+#define DATA_HDR_VIRTUAL_SIZE		0x40000000
+#define DATA_HDR_HEADER_SIZE		0x20000000
+#define DATA_HDR_BODY_SIZE		0x10000000
+
+typedef unsigned int MailDataField;
 
 #define IS_BODYSTRUCTURE_FIELD(field) \
 	(((field) & (DATA_FIELD_BODY | DATA_FIELD_BODYSTRUCTURE | \
@@ -395,7 +396,7 @@
 	/* these fields are OR'ed to the fields in index header once we
 	   get around grabbing exclusive lock */
 	unsigned int set_flags;
-	unsigned int set_cache_fields;
+	MailDataField set_cache_fields;
 
 	unsigned int anon_mmap:1;
 	unsigned int opened:1;




More information about the dovecot-cvs mailing list