summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2018-09-07 16:15:24 +0200
committerKamil Dudka <kdudka@redhat.com>2018-09-10 12:23:23 +0200
commit1d173f3413235de45828301ad554314fc8384ddf (patch)
treef687e04a25494abf41357c501c7213b007484ad4
parent2099dde2c84a57cd9fe2298f0953c5dca0e94d43 (diff)
downloadcurl-1d173f3413235de45828301ad554314fc8384ddf.tar.gz
docs/examples: do not wait when no transfers are running
Closes #2948
-rw-r--r--docs/examples/http2-download.c6
-rw-r--r--docs/examples/http2-upload.c6
-rw-r--r--docs/examples/multi-app.c6
-rw-r--r--docs/examples/multi-debugcallback.c6
-rw-r--r--docs/examples/multi-double.c6
-rw-r--r--docs/examples/multi-formadd.c6
-rw-r--r--docs/examples/multi-post.c6
-rw-r--r--docs/examples/multi-single.c6
8 files changed, 24 insertions, 24 deletions
diff --git a/docs/examples/http2-download.c b/docs/examples/http2-download.c
index 3425d302f..b4ac7c93e 100644
--- a/docs/examples/http2-download.c
+++ b/docs/examples/http2-download.c
@@ -189,7 +189,7 @@ int main(int argc, char **argv)
CURL *easy[NUM_HANDLES];
CURLM *multi_handle;
int i;
- int still_running; /* keep number of running handles */
+ int still_running = 0; /* keep number of running handles */
if(argc > 1)
/* if given a number, do that many transfers */
@@ -215,7 +215,7 @@ int main(int argc, char **argv)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
- do {
+ while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@@ -284,7 +284,7 @@ int main(int argc, char **argv)
curl_multi_perform(multi_handle, &still_running);
break;
}
- } while(still_running);
+ }
curl_multi_cleanup(multi_handle);
diff --git a/docs/examples/http2-upload.c b/docs/examples/http2-upload.c
index 06ff04091..2717998ca 100644
--- a/docs/examples/http2-upload.c
+++ b/docs/examples/http2-upload.c
@@ -245,7 +245,7 @@ int main(int argc, char **argv)
CURL *easy[NUM_HANDLES];
CURLM *multi_handle;
int i;
- int still_running; /* keep number of running handles */
+ int still_running = 0; /* keep number of running handles */
const char *filename = "index.html";
if(argc > 1)
@@ -279,7 +279,7 @@ int main(int argc, char **argv)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
- do {
+ while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@@ -348,7 +348,7 @@ int main(int argc, char **argv)
curl_multi_perform(multi_handle, &still_running);
break;
}
- } while(still_running);
+ }
curl_multi_cleanup(multi_handle);
diff --git a/docs/examples/multi-app.c b/docs/examples/multi-app.c
index 74b2a9426..fc31f5e68 100644
--- a/docs/examples/multi-app.c
+++ b/docs/examples/multi-app.c
@@ -48,7 +48,7 @@ int main(void)
CURL *handles[HANDLECOUNT];
CURLM *multi_handle;
- int still_running; /* keep number of running handles */
+ int still_running = 0; /* keep number of running handles */
int i;
CURLMsg *msg; /* for picking up messages with the transfer status */
@@ -74,7 +74,7 @@ int main(void)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
- do {
+ while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@@ -142,7 +142,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
break;
}
- } while(still_running);
+ }
/* See how the transfers went */
while((msg = curl_multi_info_read(multi_handle, &msgs_left))) {
diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c
index 11ab74b71..fa95179de 100644
--- a/docs/examples/multi-debugcallback.c
+++ b/docs/examples/multi-debugcallback.c
@@ -131,7 +131,7 @@ int main(void)
CURL *http_handle;
CURLM *multi_handle;
- int still_running; /* keep number of running handles */
+ int still_running = 0; /* keep number of running handles */
http_handle = curl_easy_init();
@@ -150,7 +150,7 @@ int main(void)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
- do {
+ while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@@ -221,7 +221,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
break;
}
- } while(still_running);
+ }
curl_multi_cleanup(multi_handle);
diff --git a/docs/examples/multi-double.c b/docs/examples/multi-double.c
index 343453939..79e44ca88 100644
--- a/docs/examples/multi-double.c
+++ b/docs/examples/multi-double.c
@@ -42,7 +42,7 @@ int main(void)
CURL *http_handle2;
CURLM *multi_handle;
- int still_running; /* keep number of running handles */
+ int still_running = 0; /* keep number of running handles */
http_handle = curl_easy_init();
http_handle2 = curl_easy_init();
@@ -63,7 +63,7 @@ int main(void)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
- do {
+ while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@@ -132,7 +132,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
break;
}
- } while(still_running);
+ }
curl_multi_cleanup(multi_handle);
diff --git a/docs/examples/multi-formadd.c b/docs/examples/multi-formadd.c
index bd85cc641..975cb605e 100644
--- a/docs/examples/multi-formadd.c
+++ b/docs/examples/multi-formadd.c
@@ -35,7 +35,7 @@ int main(void)
CURL *curl;
CURLM *multi_handle;
- int still_running;
+ int still_running = 0;
struct curl_httppost *formpost = NULL;
struct curl_httppost *lastptr = NULL;
@@ -83,7 +83,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
- do {
+ while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@@ -154,7 +154,7 @@ int main(void)
printf("running: %d!\n", still_running);
break;
}
- } while(still_running);
+ }
curl_multi_cleanup(multi_handle);
diff --git a/docs/examples/multi-post.c b/docs/examples/multi-post.c
index 95d71bea9..fe543312a 100644
--- a/docs/examples/multi-post.c
+++ b/docs/examples/multi-post.c
@@ -35,7 +35,7 @@ int main(void)
CURL *curl;
CURLM *multi_handle;
- int still_running;
+ int still_running = 0;
curl_mime *form = NULL;
curl_mimepart *field = NULL;
@@ -79,7 +79,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
- do {
+ while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@@ -150,7 +150,7 @@ int main(void)
printf("running: %d!\n", still_running);
break;
}
- } while(still_running);
+ }
curl_multi_cleanup(multi_handle);
diff --git a/docs/examples/multi-single.c b/docs/examples/multi-single.c
index 70b6d24b2..3dca0f1af 100644
--- a/docs/examples/multi-single.c
+++ b/docs/examples/multi-single.c
@@ -51,7 +51,7 @@ int main(void)
CURL *http_handle;
CURLM *multi_handle;
- int still_running; /* keep number of running handles */
+ int still_running = 0; /* keep number of running handles */
int repeats = 0;
curl_global_init(CURL_GLOBAL_DEFAULT);
@@ -70,7 +70,7 @@ int main(void)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
- do {
+ while(still_running) {
CURLMcode mc; /* curl_multi_wait() return code */
int numfds;
@@ -97,7 +97,7 @@ int main(void)
repeats = 0;
curl_multi_perform(multi_handle, &still_running);
- } while(still_running);
+ }
curl_multi_remove_handle(multi_handle, http_handle);