summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-03-29 04:04:09 +0000
committerMichael Zucci <zucchi@src.gnome.org>2001-03-29 04:04:09 +0000
commitea1dc3c251b040118f10427373d47304971d05c6 (patch)
tree894602d4ed8f05e48e96fc788d7444a50b888146
parent18d71f89a84cf2f8645122db292519f49766c866 (diff)
downloadevolution-data-server-ea1dc3c251b040118f10427373d47304971d05c6.tar.gz
Optimise the match "" case, just match everything in the folder (if we
2001-03-29 Not Zed <NotZed@Ximian.com> * camel-folder-search.c (search_body_contains): Optimise the match "" case, just match everything in the folder (if we have it).
-rw-r--r--camel/ChangeLog3
-rw-r--r--camel/camel-folder-search.c13
2 files changed, 14 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 4fe0f2270..6b23def26 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,8 @@
2001-03-29 Not Zed <NotZed@Ximian.com>
+ * 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 7afb148b0..7893ee13e 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;i<argc && !truth;i++) {
if (argv[i]->type == 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;i<search->summary->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);