[dovecot-cvs] dovecot/src/lib-index mail-cache-fields.c, 1.19, 1.20 mail-index-sync-update.c, 1.91, 1.92

cras at dovecot.org cras at dovecot.org
Tue Feb 14 20:59:20 EET 2006


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

Modified Files:
	mail-cache-fields.c mail-index-sync-update.c 
Log Message:
While casting const pointers to something else, the const was often
unneededly dropped out in the middle of casts.



Index: mail-cache-fields.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-fields.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mail-cache-fields.c	8 Feb 2006 17:52:45 -0000	1.19
+++ mail-cache-fields.c	14 Feb 2006 18:59:17 -0000	1.20
@@ -16,6 +16,7 @@
 				unsigned int fields_count)
 {
 	void *orig_key, *orig_value;
+	char *name;
 	unsigned int new_idx;
 	unsigned int i, j;
 
@@ -60,9 +61,9 @@
 			continue;
 
 		/* new index - save it */
+		name = p_strdup(cache->field_pool, fields[i].name);
 		cache->fields[idx].field = fields[i];
-		cache->fields[idx].field.name =
-			p_strdup(cache->field_pool, fields[i].name);
+		cache->fields[idx].field.name = name;
 		cache->field_file_map[idx] = (uint32_t)-1;
 
 		switch (cache->fields[idx].field.type) {
@@ -76,9 +77,7 @@
 			break;
 		}
 
-		hash_insert(cache->field_name_hash,
-			    (char *)cache->fields[idx].field.name,
-			    POINTER_CAST(idx));
+		hash_insert(cache->field_name_hash, name, POINTER_CAST(idx));
 	}
 	cache->fields_count = new_idx;
 }

Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- mail-index-sync-update.c	14 Jan 2006 18:47:34 -0000	1.91
+++ mail-index-sync-update.c	14 Feb 2006 18:59:17 -0000	1.92
@@ -749,7 +749,7 @@
 
 		memcpy(map->mmap_base, &map->hdr, base_size);
 		memcpy(PTR_OFFSET(map->mmap_base, base_size),
-		       PTR_OFFSET(map->hdr_base, base_size),
+		       CONST_PTR_OFFSET(map->hdr_base, base_size),
 		       map->hdr.header_size - base_size);
 		if (msync(map->mmap_base, map->mmap_used_size, MS_SYNC) < 0) {
 			mail_index_set_syscall_error(index, "msync()");



More information about the dovecot-cvs mailing list