aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-text-index.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-04-26 13:13:45 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-04-26 13:13:45 +0800
commitdf00976fe425356187dbbd72b8080ae4a1d9dd01 (patch)
tree83b4b4c1abd23bf1287323893266e9c320037207 /camel/camel-text-index.c
parent8358adf1acfb1a3c679f9f9fa71106c037587103 (diff)
downloadgsoc2013-evolution-df00976fe425356187dbbd72b8080ae4a1d9dd01.tar.gz
gsoc2013-evolution-df00976fe425356187dbbd72b8080ae4a1d9dd01.tar.zst
gsoc2013-evolution-df00976fe425356187dbbd72b8080ae4a1d9dd01.zip
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. svn path=/trunk/; revision=16591
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 9822df85f1..ab2ec72661 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;