commit 503478533ce4221c88c9614d515479d78837c595
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Fri Nov 22 17:50:01 2019 +0100

    de-duplicate FETCH response data item traversal somewhat

 src/drv_imap.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index 826e12b..92008b7 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -1060,15 +1060,15 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char 
*s ATTR_UNUSED )
                        error( "IMAP error: bogus item name in FETCH 
response\n" );
                        goto ffail;
                }
-               if (!strcmp( "UID", tmp->val )) {
-                       tmp = tmp->next;
+               const char *name = tmp->val;
+               tmp = tmp->next;
+               if (!strcmp( "UID", name )) {
                        if (!is_atom( tmp ) || (uid = strtoul( tmp->val, &ep, 
10 ), *ep)) {
                                error( "IMAP error: unable to parse UID\n" );
                                goto ffail;
                        }
                        continue;  // This *is* the UID.
-               } else if (!strcmp( "FLAGS", tmp->val )) {
-                       tmp = tmp->next;
+               } else if (!strcmp( "FLAGS", name )) {
                        if (!is_list( tmp )) {
                                error( "IMAP error: unable to parse FLAGS\n" );
                                goto ffail;
@@ -1076,8 +1076,7 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s 
ATTR_UNUSED )
                        if (!parse_fetched_flags( tmp->child, &mask, &status ))
                                goto ffail;
                        continue;  // This may legitimately come without UID.
-               } else if (!strcmp( "INTERNALDATE", tmp->val )) {
-                       tmp = tmp->next;
+               } else if (!strcmp( "INTERNALDATE", name )) {
                        if (!is_atom( tmp )) {
                                error( "IMAP error: unable to parse 
INTERNALDATE\n" );
                                goto ffail;
@@ -1086,21 +1085,18 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char 
*s ATTR_UNUSED )
                                error( "IMAP error: unable to parse 
INTERNALDATE format\n" );
                                goto ffail;
                        }
-               } else if (!strcmp( "RFC822.SIZE", tmp->val )) {
-                       tmp = tmp->next;
+               } else if (!strcmp( "RFC822.SIZE", name )) {
                        if (!is_atom( tmp ) || (size = strtoul( tmp->val, &ep, 
10 ), *ep)) {
                                error( "IMAP error: unable to parse 
RFC822.SIZE\n" );
                                goto ffail;
                        }
-               } else if (!strcmp( "BODY[]", tmp->val )) {
-                       tmp = tmp->next;
+               } else if (!strcmp( "BODY[]", name )) {
                        if (!is_atom( tmp )) {
                                error( "IMAP error: unable to parse BODY[]\n" );
                                goto ffail;
                        }
                        body = tmp;
-               } else if (!strcmp( "BODY[HEADER.FIELDS", tmp->val )) {
-                       tmp = tmp->next;
+               } else if (!strcmp( "BODY[HEADER.FIELDS", name )) {
                        if (!is_list( tmp )) {
                          bfail:
                                error( "IMAP error: unable to parse 
BODY[HEADER.FIELDS ...]\n" );


_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to