[balsa] Simplify, and fix string and boolean filter comparisons
- From: Peter Bloomfield <PeterB src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [balsa] Simplify, and fix string and boolean filter comparisons
- Date: Sun, 20 Dec 2009 03:08:47 +0000 (UTC)
commit edf32c047ebb7629a5ffebae56ecbb85d9d1f9dc
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat Dec 19 22:08:39 2009 -0500
Simplify, and fix string and boolean filter comparisons
ChangeLog | 5 +++++
libbalsa/filter-funcs.c | 15 ++++++---------
2 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index da0493b..702b3a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-19 Peter Bloomfield
+
+ * libbalsa/filter-funcs.c (libbalsa_condition_compare):
+ simplify, and fix string and boolean filter comparisons.
+
2009-12-16 Peter Bloomfield
* libbalsa/send.c (libbalsa_message_create_mime_message): do not
diff --git a/libbalsa/filter-funcs.c b/libbalsa/filter-funcs.c
index cb20d4f..9610b33 100644
--- a/libbalsa/filter-funcs.c
+++ b/libbalsa/filter-funcs.c
@@ -495,13 +495,12 @@ libbalsa_condition_compare(LibBalsaCondition *c1,LibBalsaCondition *c2)
if (c1 == c2)
return TRUE;
- if (c1 == NULL || c2 == NULL)
+ if (c1 == NULL || c2 == NULL || c1->type != c2->type)
return FALSE;
switch (c1->type) {
case CONDITION_STRING:
- res = (c2->type == CONDITION_STRING ||
- g_ascii_strcasecmp(c1->match.string.string,
+ res = (g_ascii_strcasecmp(c1->match.string.string,
c2->match.string.string) == 0);
break;
case CONDITION_REGEX:
@@ -512,8 +511,7 @@ libbalsa_condition_compare(LibBalsaCondition *c1,LibBalsaCondition *c2)
#endif
break;
case CONDITION_DATE:
- res = (c2->type == CONDITION_DATE &&
- c1->match.date.date_low == c2->match.date.date_low &&
+ res = (c1->match.date.date_low == c2->match.date.date_low &&
c1->match.date.date_high == c2->match.date.date_high);
break;
case CONDITION_FLAG:
@@ -522,11 +520,10 @@ libbalsa_condition_compare(LibBalsaCondition *c1,LibBalsaCondition *c2)
break;
case CONDITION_AND:
case CONDITION_OR:
- res = ((c1->type == c2->type) &&
- libbalsa_condition_compare(c1->match.andor.left,
+ res = (libbalsa_condition_compare(c1->match.andor.left,
c2->match.andor.left) &&
- libbalsa_condition_compare(c1->match.andor.left,
- c2->match.andor.left));
+ libbalsa_condition_compare(c1->match.andor.right,
+ c2->match.andor.right));
break;
case CONDITION_NONE:
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]