Replace all discrete checks for empty message fields by CM_IsEmpty()
[citadel.git] / citadel / modules / imap / imap_search.c
index 387e747c9e080eb67a353b9418cff4b1872bf8a5..aaa02dbe23260e4c3fbd8e22aa3317552b09df0f 100644 (file)
@@ -142,7 +142,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) < 0) {
                                        match = 1;
@@ -308,7 +308,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) == 0) {
                                        match = 1;
@@ -338,7 +338,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) < 0) {
                                        match = 1;
@@ -354,7 +354,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) == 0) {
                                        match = 1;
@@ -370,7 +370,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) >= 0) {
                                        match = 1;
@@ -386,7 +386,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) >= 0) {
                                        match = 1;