aboutsummaryrefslogtreecommitdiff
path: root/docs/examples/multi-app.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-02-11 09:42:38 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-02-11 09:44:45 +0100
commit3a6563d668406df1703edb4202afc038fcf9d30e (patch)
tree0fbb9438d99c13049f72b10c966583e582e4e238 /docs/examples/multi-app.c
parent936d8f07dfbf2ac22ffd216f5363152bcecc2651 (diff)
examples: adhere to curl code style
All plain C examples now (mostly) adhere to the curl code style. While they are only examples, they had diverted so much and contained all sorts of different mixed code styles by now. Having them use a unified style helps users and readability. Also, as they get copy-and-pasted widely by users, making sure they're clean and nice is a good idea. 573 checksrc warnings were addressed.
Diffstat (limited to 'docs/examples/multi-app.c')
-rw-r--r--docs/examples/multi-app.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/docs/examples/multi-app.c b/docs/examples/multi-app.c
index 421b8f4a9..f8447930a 100644
--- a/docs/examples/multi-app.c
+++ b/docs/examples/multi-app.c
@@ -55,8 +55,8 @@ int main(void)
int msgs_left; /* how many messages are left */
/* Allocate one CURL handle per transfer */
- for (i=0; i<HANDLECOUNT; i++)
- handles[i] = curl_easy_init();
+ for(i=0; i<HANDLECOUNT; i++)
+ handles[i] = curl_easy_init();
/* set the options (I left out a few, you'll get the point anyway) */
curl_easy_setopt(handles[HTTP_HANDLE], CURLOPT_URL, "http://example.com");
@@ -68,8 +68,8 @@ int main(void)
multi_handle = curl_multi_init();
/* add the individual transfers */
- for (i=0; i<HANDLECOUNT; i++)
- curl_multi_add_handle(multi_handle, handles[i]);
+ for(i=0; i<HANDLECOUNT; i++)
+ curl_multi_add_handle(multi_handle, handles[i]);
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
@@ -106,8 +106,7 @@ int main(void)
/* get file descriptors from the transfers */
mc = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
- if(mc != CURLM_OK)
- {
+ if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_fdset() failed, code %d.\n", mc);
break;
}
@@ -146,12 +145,12 @@ int main(void)
} while(still_running);
/* See how the transfers went */
- while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) {
- if (msg->msg == CURLMSG_DONE) {
+ 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; idx<HANDLECOUNT; idx++) {
+ for(idx=0; idx<HANDLECOUNT; idx++) {
found = (msg->easy_handle == handles[idx]);
if(found)
break;
@@ -171,8 +170,8 @@ int main(void)
curl_multi_cleanup(multi_handle);
/* Free the CURL handles */
- for (i=0; i<HANDLECOUNT; i++)
- curl_easy_cleanup(handles[i]);
+ for(i=0; i<HANDLECOUNT; i++)
+ curl_easy_cleanup(handles[i]);
return 0;
}