diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-01-06 07:36:00 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-01-06 07:36:00 +0000 |
commit | 7104ea2d5c662e0a2ee874076c07e3bad53cfa18 (patch) | |
tree | 99604ce787ce7a3999f8839f3fdbe690d2145c46 | |
parent | bdb537c3d2ff230bf842678e49025180b7cdfa57 (diff) |
fixes a bug that search cache occasionally didn't work.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@875 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ChangeLog.ja | 5 | ||||
-rw-r--r-- | libsylph/virtual.c | 19 |
3 files changed, 24 insertions, 5 deletions
@@ -1,5 +1,10 @@ 2006-01-06 + * libsylph/virtual.c: don't compare temporary flags (fixes a bug that + search cache occasionally didn't work). + +2006-01-06 + * src/summary_search.c src/prefs_filter_edit.[ch]: prefs_filter_edit_cond_edit_to_list(): added for minor code cleanup. diff --git a/ChangeLog.ja b/ChangeLog.ja index d0afd746..c4dc1ca1 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,10 @@ 2006-01-06 + * libsylph/virtual.c: 一時フラグを比較しないようにした(検索キャッシュ + がたまに働かなかったバグを修正)。 + +2006-01-06 + * src/summary_search.c src/prefs_filter_edit.[ch]: prefs_filter_edit_cond_edit_to_list(): コードの整理のために追加。 diff --git a/libsylph/virtual.c b/libsylph/virtual.c index 388e4d9c..f7138c1c 100644 --- a/libsylph/virtual.c +++ b/libsylph/virtual.c @@ -174,7 +174,7 @@ guint sinfo_hash(gconstpointer key) h ^= sinfo->msgnum; h ^= (guint)sinfo->size; h ^= (guint)sinfo->mtime; - h ^= (guint)sinfo->flags.tmp_flags; + /* h ^= (guint)sinfo->flags.tmp_flags; */ h ^= (guint)sinfo->flags.perm_flags; /* g_print("path: %s, n = %u, hash = %u\n", @@ -190,7 +190,7 @@ gint sinfo_equal(gconstpointer v, gconstpointer v2) return (s1->folder == s2->folder && s1->msgnum == s2->msgnum && s1->size == s2->size && s1->mtime == s2->mtime && - s1->flags.tmp_flags == s2->flags.tmp_flags && + /* s1->flags.tmp_flags == s2->flags.tmp_flags && */ s1->flags.perm_flags == s2->flags.perm_flags); } @@ -212,6 +212,7 @@ static GHashTable *virtual_read_search_cache(FolderItem *item) gchar *path, *file; FILE *fp; gchar *id; + gint count = 0; g_return_val_if_fail(item != NULL, NULL); @@ -257,10 +258,13 @@ static GHashTable *virtual_read_search_cache(FolderItem *item) sinfo->flags = flags; g_hash_table_insert(table, sinfo, GINT_TO_POINTER(matched)); + ++count; } } } + debug_print("%d cache items read.\n", count); + fclose(fp); return table; } @@ -287,7 +291,8 @@ static void virtual_write_search_cache(FILE *fp, FolderItem *item, WRITE_CACHE_DATA_INT(msginfo->msgnum, fp); WRITE_CACHE_DATA_INT(msginfo->size, fp); WRITE_CACHE_DATA_INT(msginfo->mtime, fp); - WRITE_CACHE_DATA_INT(msginfo->flags.tmp_flags, fp); + WRITE_CACHE_DATA_INT + ((msginfo->flags.tmp_flags & MSG_CACHED_FLAG_MASK), fp); WRITE_CACHE_DATA_INT(msginfo->flags.perm_flags, fp); WRITE_CACHE_DATA_INT(matched, fp); } @@ -313,7 +318,7 @@ static GSList *virtual_search_folder(VirtualSearchInfo *info, FolderItem *item) GSList *cur; FilterInfo fltinfo; gboolean full_headers; - gint count = 1, total; + gint count = 1, total, ncachehit = 0; GTimeVal tv_prev, tv_cur; g_return_val_if_fail(info != NULL, NULL); @@ -371,10 +376,12 @@ static GSList *virtual_search_folder(VirtualSearchInfo *info, FolderItem *item) cur->data = NULL; virtual_write_search_cache(info->fp, NULL, msginfo, matched); + ++ncachehit; continue; } else if (matched == SCACHE_NOT_MATCHED) { virtual_write_search_cache(info->fp, NULL, msginfo, matched); + ++ncachehit; continue; } } @@ -405,6 +412,8 @@ static GSList *virtual_search_folder(VirtualSearchInfo *info, FolderItem *item) procheader_header_list_destroy(hlist); } + debug_print("%d cache hits (%d total)\n", ncachehit, total); + virtual_write_search_cache(info->fp, NULL, NULL, 0); procmsg_msg_list_free(mlist); @@ -536,7 +545,7 @@ static gint virtual_remove_folder(Folder *folder, FolderItem *item) { gchar *path; - g_return_val_if_fail(item != NULL, NULL); + g_return_val_if_fail(item != NULL, -1); g_return_val_if_fail(item->stype == F_VIRTUAL, -1); path = folder_item_get_path(item); |