diff options
author | Marcel Raad <Marcel.Raad@teamviewer.com> | 2019-05-21 10:44:16 +0200 |
---|---|---|
committer | Marcel Raad <Marcel.Raad@teamviewer.com> | 2019-05-22 10:06:21 +0200 |
commit | 10b7067eb722bf2bc19f4dd6d97199be705baea2 (patch) | |
tree | d6a5e6ff76b923997ab6f859ac3d1015e9c30f81 /docs/examples/smooth-gtk-thread.c | |
parent | 918987a844912b431f132b5c4d49fb73a0cb1a0e (diff) | |
download | curl-10b7067eb722bf2bc19f4dd6d97199be705baea2.tar.gz |
examples: reduce variable scopes
Closes https://github.com/curl/curl/pull/3919
Diffstat (limited to 'docs/examples/smooth-gtk-thread.c')
-rw-r--r-- | docs/examples/smooth-gtk-thread.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/docs/examples/smooth-gtk-thread.c b/docs/examples/smooth-gtk-thread.c index 66d8c10b5..b64c48610 100644 --- a/docs/examples/smooth-gtk-thread.c +++ b/docs/examples/smooth-gtk-thread.c @@ -67,13 +67,12 @@ size_t write_file(void *ptr, size_t size, size_t nmemb, FILE *stream) /* https://weather.com/weather/today/l/46214?cc=*&dayf=5&unit=i */ void *pull_one_url(void *NaN) { - CURL *curl; - gchar *http; - FILE *outfile; - /* Stop threads from entering unless j is incremented */ pthread_mutex_lock(&lock); while(j < num_urls) { + CURL *curl; + gchar *http; + printf("j = %d\n", j); http = @@ -85,7 +84,7 @@ void *pull_one_url(void *NaN) curl = curl_easy_init(); if(curl) { - outfile = fopen(urls[j], "wb"); + FILE *outfile = fopen(urls[j], "wb"); /* Set the URL and transfer type */ curl_easy_setopt(curl, CURLOPT_URL, http); |