mirror of
https://github.com/curl/curl.git
synced 2026-07-24 12:17:16 +03:00
examples: check more errors, fix cleanups, scope variables
Inspired by Joshua's report on examples. Closes #19055
This commit is contained in:
parent
61dcb56743
commit
64ed2ea196
42 changed files with 874 additions and 785 deletions
|
|
@ -37,8 +37,7 @@ struct Memory {
|
|||
size_t size;
|
||||
};
|
||||
|
||||
static size_t
|
||||
write_cb(void *contents, size_t size, size_t nmemb, void *userp)
|
||||
static size_t write_cb(void *contents, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
size_t realsize = size * nmemb;
|
||||
struct Memory *mem = (struct Memory *)userp;
|
||||
|
|
@ -125,10 +124,8 @@ int main(void)
|
|||
{
|
||||
CURL *easy;
|
||||
CURLM *multi;
|
||||
int still_running; /* keep number of running handles */
|
||||
int transfers = 1; /* we start with one */
|
||||
int i;
|
||||
struct CURLMsg *m;
|
||||
|
||||
CURLcode res = curl_global_init(CURL_GLOBAL_ALL);
|
||||
if(res)
|
||||
|
|
@ -150,7 +147,10 @@ int main(void)
|
|||
curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &transfers);
|
||||
|
||||
while(transfers) {
|
||||
struct CURLMsg *m;
|
||||
int still_running; /* keep number of running handles */
|
||||
int rc;
|
||||
|
||||
CURLMcode mcode = curl_multi_perform(multi, &still_running);
|
||||
if(mcode)
|
||||
break;
|
||||
|
|
@ -173,7 +173,6 @@ int main(void)
|
|||
curl_easy_cleanup(e);
|
||||
}
|
||||
} while(m);
|
||||
|
||||
}
|
||||
|
||||
curl_multi_cleanup(multi);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue