changeset 6487:fda4b611440b HEAD

Small code optimization.
author Timo Sirainen <tss@iki.fi>
date Sun, 23 Sep 2007 14:26:58 +0300
parents 33480577814e
children 013e84571cc8
files src/lib-storage/index/index-search.c
diffstat 1 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-search.c	Sun Sep 23 14:21:53 2007 +0300
+++ b/src/lib-storage/index/index-search.c	Sun Sep 23 14:26:58 2007 +0300
@@ -807,16 +807,12 @@
 	struct mail_search_arg *sub;
 
 	for (; args != NULL;) {
-		if (args->not && args->type == SEARCH_SUB) {
-			/* neg(p and q and ..) == neg(p) or neg(q) or .. */
-			args->type = SEARCH_OR;
-			args->not = FALSE;
-			sub = args->value.subargs;
-			for (; sub != NULL; sub = sub->next)
-				sub->not = !sub->not;
-		} else if (args->not && args->type == SEARCH_OR) {
-			/* neg(p or q or ..) == neg(p) and neg(q) and .. */
-			args->type = SEARCH_SUB;
+		if (args->not && (args->type == SEARCH_SUB ||
+				  args->type == SEARCH_OR)) {
+			/* neg(p and q and ..) == neg(p) or neg(q) or ..
+			   neg(p or q or ..) == neg(p) and neg(q) and .. */
+			args->type = args->type == SEARCH_SUB ?
+				SEARCH_OR : SEARCH_SUB;
 			args->not = FALSE;
 			sub = args->value.subargs;
 			for (; sub != NULL; sub = sub->next)