From 22d404e40b3fead89faad4e12a0ac6a23caf2317 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 29 Mar 2001 04:04:09 +0000 Subject: Optimise the match "" case, just match everything in the folder (if we 2001-03-29 Not Zed * camel-folder-search.c (search_body_contains): Optimise the match "" case, just match everything in the folder (if we have it). svn path=/trunk/; revision=9007 --- camel/ChangeLog | 3 +++ camel/camel-folder-search.c | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index 4fe0f22704..6b23def269 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,8 @@ 2001-03-29 Not Zed + * camel-folder-search.c (search_body_contains): Optimise the match + "" case, just match everything in the folder (if we have it). + * camel-vtrash-folder.c (vtrash_move_messages_to): Access the folder directly from the message info. (vtrash_move_messages_to): I think we also need to call the real diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c index 7afb148b0d..7893ee13e0 100644 --- a/camel/camel-folder-search.c +++ b/camel/camel-folder-search.c @@ -653,7 +653,9 @@ search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam if (search->current) { int truth = FALSE; - if (search->body_index) { + if (argc == 1 && argv[0]->value.string[0] == 0 && search->folder) { + truth = TRUE; + } else if (search->body_index) { for (i=0;itype == ESEXP_RES_STRING) { truth = ibex_find_name(search->body_index, (char *)camel_message_info_uid(search->current), @@ -677,7 +679,14 @@ search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam } else { r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR); - if (search->body_index) { + if (argc == 1 && argv[0]->value.string[0] == 0 && search->folder) { + /* optimise the match "" case - match everything */ + r->value.ptrarray = g_ptr_array_new(); + for (i=0;isummary->len;i++) { + CamelMessageInfo *info = g_ptr_array_index(search->summary, i); + g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(info)); + } + } else if (search->body_index) { if (argc==1) { /* common case */ r->value.ptrarray = ibex_find(search->body_index, argv[0]->value.string); -- cgit v1.2.3