[dovecot-cvs] dovecot/src/plugins/fts-squat squat-trie.c,1.7,1.8

tss at dovecot.org tss at dovecot.org
Wed Dec 13 12:31:44 UTC 2006


Update of /var/lib/cvs/dovecot/src/plugins/fts-squat
In directory talvi:/tmp/cvs-serv27064

Modified Files:
	squat-trie.c 
Log Message:
Use realloc instead of alloc+free.



Index: squat-trie.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts-squat/squat-trie.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- squat-trie.c	10 Dec 2006 00:26:58 -0000	1.7
+++ squat-trie.c	13 Dec 2006 12:31:41 -0000	1.8
@@ -920,7 +920,7 @@
 			(node->chars_16bit_count + 1) * idx_size;
 	}
 
-	new_node = i_malloc(new_size);
+	new_node = t_buffer_get(new_size);
 	if (chr < 256) {
 		hole1_pos = sizeof(*node) + char_idx;
 		old_idx_offset = sizeof(*node) + ALIGN(node->chars_8bit_count);
@@ -961,8 +961,10 @@
 	       old_size - hole2_pos);
 
 	new_node->resized = TRUE;
-	i_free(node);
-	return new_node;
+
+	node = i_realloc(node, 0, new_size);
+	memcpy(node, new_node, new_size);
+	return node;
 }
 
 static int



More information about the dovecot-cvs mailing list