summaryrefslogtreecommitdiff
path: root/camel/camel-text-index.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-04-26 05:13:45 +0000
committerMichael Zucci <zucchi@src.gnome.org>2002-04-26 05:13:45 +0000
commita6327687bd770d9d2d735465560a756ab49071b7 (patch)
tree61e17c1dbf82688085ea9427d83396915619e985 /camel/camel-text-index.c
parent8db5234be8ca53feaca5c94c22ffae1f51049a84 (diff)
downloadevolution-data-server-a6327687bd770d9d2d735465560a756ab49071b7.tar.gz
Remove the excessive \n's, after printfs.
2002-04-26 Not Zed <NotZed@Ximian.com> * camel-block-file.c (block_file_validate_root): Remove the excessive \n's, after printfs. * camel-text-index.c (text_index_compress_nosync): @!#$@#$!@$#!. Since the rename op was fixed, this broke compression's rename, resulting in the index 'vanishing' after every compress (i.e. after every reindex). Fix this code to account for the fixed rename operation.
Diffstat (limited to 'camel/camel-text-index.c')
-rw-r--r--camel/camel-text-index.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/camel/camel-text-index.c b/camel/camel-text-index.c
index 9822df85f..ab2ec7266 100644
--- a/camel/camel-text-index.c
+++ b/camel/camel-text-index.c
@@ -372,12 +372,21 @@ text_index_compress_nosync(CamelIndex *idx)
camel_key_t *records, newrecords[256];
struct _CamelTextIndexRoot *rb;
- newpath = alloca(strlen(idx->path)+5);
- tmp_name(idx->path, newpath);
- savepath = alloca(strlen(idx->path)+2);
- sprintf(savepath, "%s~", idx->path);
- oldpath = alloca(strlen(idx->path)+1);
+ i = strlen(idx->path)+16;
+ oldpath = alloca(i);
+ newpath = alloca(i);
+ savepath = alloca(i);
+
strcpy(oldpath, idx->path);
+ oldpath[strlen(oldpath)-strlen(".index")] = 0;
+
+ tmp_name(oldpath, newpath);
+ sprintf(savepath, "%s~", oldpath);
+
+ d(printf("Old index: %s\n", idx->path));
+ d(printf("Old path: %s\n", oldpath));
+ d(printf("New: %s\n", newpath));
+ d(printf("Save: %s\n", savepath));
newidx = camel_text_index_new(newpath, O_RDWR|O_CREAT);
if (newidx == NULL)
@@ -504,8 +513,9 @@ fail:
/* clean up temp files always */
camel_text_index_remove(newpath);
+
+ sprintf(savepath, "%s~.index", oldpath);
unlink(savepath);
- newpath = alloca(strlen(savepath)+6);
sprintf(newpath, "%s.data", savepath);
unlink(newpath);
@@ -1519,7 +1529,7 @@ camel_text_index_name_new(CamelTextIndex *idx, const char *name, camel_key_t nam
cin->index = (CamelIndex *)idx;
camel_object_ref((CamelObject *)idx);
- cin->name = g_strdup(name);
+ cin->name = e_mempool_strdup(p->pool, name);
p->nameid = nameid;
return idn;