dovecot: Small code optimization.

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 23 14:27:05 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/fda4b611440b
changeset: 6487:fda4b611440b
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Sep 23 14:26:58 2007 +0300
description:
Small code optimization.

diffstat:

1 file changed, 6 insertions(+), 10 deletions(-)
src/lib-storage/index/index-search.c |   16 ++++++----------

diffs (26 lines):

diff -r 33480577814e -r fda4b611440b src/lib-storage/index/index-search.c
--- 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 @@ static void search_args_fix_subs(struct 
 	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)


More information about the dovecot-cvs mailing list