]> granicus.if.org Git - curl/commitdiff
smtp-multi.c: Minor coding style tidyup following POP3 and IMAP additions
authorSteve Holme <steve_holme@hotmail.com>
Sun, 12 Jan 2014 18:24:44 +0000 (18:24 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Sun, 12 Jan 2014 18:24:48 +0000 (18:24 +0000)
docs/examples/smtp-multi.c

index 5a3125b7caf1fccf4f4c403262f5e59fe1bf78a7..7f3d333dfe091dadcadb4a51f37e8c02400077e2 100644 (file)
@@ -78,19 +78,19 @@ static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
 
 static struct timeval tvnow(void)
 {
-  /*
-  ** time() returns the value of time in seconds since the Epoch.
-  */
   struct timeval now;
+
+  /* time() returns the value of time in seconds since the epoch */
   now.tv_sec = (long)time(NULL);
   now.tv_usec = 0;
+
   return now;
 }
 
 static long tvdiff(struct timeval newer, struct timeval older)
 {
-  return (newer.tv_sec-older.tv_sec)*1000+
-    (newer.tv_usec-older.tv_usec)/1000;
+  return (newer.tv_sec - older.tv_sec) * 1000 +
+    (newer.tv_usec - older.tv_usec) / 1000;
 }
 
 int main(void)
@@ -150,15 +150,15 @@ int main(void)
 
   while(still_running) {
     struct timeval timeout;
-    int rc; /* select() return code */
-
     fd_set fdread;
     fd_set fdwrite;
     fd_set fdexcep;
     int maxfd = -1;
+    int rc;
 
     long curl_timeo = -1;
 
+    /* Initialise the file descriptors */
     FD_ZERO(&fdread);
     FD_ZERO(&fdwrite);
     FD_ZERO(&fdexcep);
@@ -187,17 +187,16 @@ int main(void)
     rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
     if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
-      fprintf(stderr, "ABORTING TEST, since it seems "
-              "that it would have run forever.\n");
+      fprintf(stderr,
+              "ABORTING: Since it seems that we would have run forever.\n");
       break;
     }
 
     switch(rc) {
-    case -1:
-      /* select error */
+    case -1:  /* select error */
       break;
-    case 0: /* timeout */
-    default: /* action */
+    case 0:   /* timeout */
+    default:  /* action */
       curl_multi_perform(mcurl, &still_running);
       break;
     }