]> granicus.if.org Git - curl/commitdiff
Yun Fu pointed out a flaw in the loop that checks handles, and I indented
authorDaniel Stenberg <daniel@haxx.se>
Thu, 21 Jan 2010 09:53:30 +0000 (09:53 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 21 Jan 2010 09:53:30 +0000 (09:53 +0000)
the code more curl-style

docs/examples/multi-app.c

index a8a92ab338a40f24ca6976fd6d4a77191a8f81f6..fa3349822cee656504c1b1b62192175bf9f180af 100644 (file)
@@ -105,20 +105,23 @@ int main(int argc, char **argv)
   /* See how the transfers went */
   while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) {
     if (msg->msg == CURLMSG_DONE) {
-
-       int idx, found = 0;
-
-       /* Find out which handle this message is about */
-       for (idx=0; (!found && (idx<HANDLECOUNT)); idx++) found = (msg->easy_handle == handles[idx]);
-
-       switch (idx) {
-         case HTTP_HANDLE:
-           printf("HTTP transfer completed with status %d\n", msg->data.result);
-           break;
-         case FTP_HANDLE:
-           printf("FTP transfer completed with status %d\n", msg->data.result);
-           break;
-       }
+      int idx, found = 0;
+
+      /* Find out which handle this message is about */
+      for (idx=0; idx<HANDLECOUNT; idx++) {
+        found = (msg->easy_handle == handles[idx]);
+        if(found)
+          break;
+      }
+
+      switch (idx) {
+      case HTTP_HANDLE:
+        printf("HTTP transfer completed with status %d\n", msg->data.result);
+        break;
+      case FTP_HANDLE:
+        printf("FTP transfer completed with status %d\n", msg->data.result);
+        break;
+      }
     }
   }