aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-folder-search.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-03-29 12:04:09 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-03-29 12:04:09 +0800
commit22d404e40b3fead89faad4e12a0ac6a23caf2317 (patch)
treed706e909240e40e2834a674b378acf2032cf0415 /camel/camel-folder-search.c
parent1b6fe39a3c556248852a47b871eefac477450cf0 (diff)
downloadgsoc2013-evolution-22d404e40b3fead89faad4e12a0ac6a23caf2317.tar
gsoc2013-evolution-22d404e40b3fead89faad4e12a0ac6a23caf2317.tar.gz
gsoc2013-evolution-22d404e40b3fead89faad4e12a0ac6a23caf2317.tar.bz2
gsoc2013-evolution-22d404e40b3fead89faad4e12a0ac6a23caf2317.tar.lz
gsoc2013-evolution-22d404e40b3fead89faad4e12a0ac6a23caf2317.tar.xz
gsoc2013-evolution-22d404e40b3fead89faad4e12a0ac6a23caf2317.tar.zst
gsoc2013-evolution-22d404e40b3fead89faad4e12a0ac6a23caf2317.zip
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). svn path=/trunk/; revision=9007
Diffstat (limited to 'camel/camel-folder-search.c')
-rw-r--r--camel/camel-folder-search.c13
1 files changed, 11 insertions, 2 deletions
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;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);