email: Tidied up the *_regular_transfer() functions
authorSteve Holme <steve_holme@hotmail.com>
Fri, 8 Mar 2013 23:25:04 +0000 (23:25 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Fri, 8 Mar 2013 23:25:04 +0000 (23:25 +0000)
Added comments and simplified convoluted dophase_done comparison.

lib/imap.c
lib/pop3.c
lib/smtp.c

index 136d643794368540429ce7e495e9f4ecbe5e3277..6ce6b12ece4ba22bb52adef5d71dee2d3b98d006 100644 (file)
@@ -2222,20 +2222,18 @@ static CURLcode imap_regular_transfer(struct connectdata *conn,
   /* Make sure size is unknown at this point */
   data->req.size = -1;
 
+  /* Set the progress data */
   Curl_pgrsSetUploadCounter(data, 0);
   Curl_pgrsSetDownloadCounter(data, 0);
   Curl_pgrsSetUploadSize(data, 0);
   Curl_pgrsSetDownloadSize(data, 0);
 
+  /* Carry out the perform */
   result = imap_perform(conn, &connected, dophase_done);
 
-  if(!result) {
-    if(!*dophase_done)
-      /* The DO phase has not completed yet */
-      return CURLE_OK;
-
+  /* Perform post DO phase operations if necessary */
+  if(!result && *dophase_done)
     result = imap_dophase_done(conn, connected);
-  }
 
   return result;
 }
index 28a359ebe9659a31a85e55737c32b015707cf765..4c008cafb4b29e4b25bdfc9ce2f475a52895e607 100644 (file)
@@ -1594,20 +1594,18 @@ static CURLcode pop3_regular_transfer(struct connectdata *conn,
   /* Make sure size is unknown at this point */
   data->req.size = -1;
 
+  /* Set the progress data */
   Curl_pgrsSetUploadCounter(data, 0);
   Curl_pgrsSetDownloadCounter(data, 0);
   Curl_pgrsSetUploadSize(data, 0);
   Curl_pgrsSetDownloadSize(data, 0);
 
+  /* Carry out the perform */
   result = pop3_perform(conn, &connected, dophase_done);
 
-  if(!result) {
-    if(!*dophase_done)
-      /* The DO phase has not completed yet */
-      return CURLE_OK;
-
+  /* Perform post DO phase operations if necessary */
+  if(!result && *dophase_done)
     result = pop3_dophase_done(conn, connected);
-  }
 
   return result;
 }
index 21c202e3c10cafd723c89dcd8c85a456d889304e..c9669dafc478f3b3962c5f39a98170b690b365c1 100644 (file)
@@ -1593,20 +1593,18 @@ static CURLcode smtp_regular_transfer(struct connectdata *conn,
   /* Make sure size is unknown at this point */
   data->req.size = -1;
 
+  /* Set the progress data */
   Curl_pgrsSetUploadCounter(data, 0);
   Curl_pgrsSetDownloadCounter(data, 0);
   Curl_pgrsSetUploadSize(data, 0);
   Curl_pgrsSetDownloadSize(data, 0);
 
+  /* Carry out the perform */
   result = smtp_perform(conn, &connected, dophase_done);
 
-  if(!result) {
-    if(!*dophase_done)
-      /* The DO phase has not completed yet */
-      return CURLE_OK;
-
+  /* Perform post DO phase operations if necessary */
+  if(!result && *dophase_done)
     result = smtp_dophase_done(conn, connected);
-  }
 
   return result;
 }