diff options
Diffstat (limited to 'tests/libtest')
-rw-r--r-- | tests/libtest/lib1537.c | 15 | ||||
-rw-r--r-- | tests/libtest/lib1554.c | 3 | ||||
-rw-r--r-- | tests/libtest/lib1900.c | 8 | ||||
-rw-r--r-- | tests/libtest/lib506.c | 2 | ||||
-rw-r--r-- | tests/libtest/lib512.c | 6 | ||||
-rw-r--r-- | tests/libtest/lib556.c | 2 | ||||
-rw-r--r-- | tests/libtest/lib579.c | 3 | ||||
-rw-r--r-- | tests/libtest/lib586.c | 2 | ||||
-rw-r--r-- | tests/libtest/testtrace.c | 2 |
9 files changed, 17 insertions, 26 deletions
diff --git a/tests/libtest/lib1537.c b/tests/libtest/lib1537.c index b07d64fc5..9832c3a30 100644 --- a/tests/libtest/lib1537.c +++ b/tests/libtest/lib1537.c @@ -43,8 +43,7 @@ int test(char *URL) asize = (int)sizeof(a); ptr = curl_easy_escape(NULL, (char *)a, asize); printf("%s\n", ptr); - if(ptr) - curl_free(ptr); + curl_free(ptr); /* deprecated API */ ptr = curl_escape((char *)a, asize); @@ -58,8 +57,7 @@ int test(char *URL) printf("outlen == %d\n", outlen); printf("unescape == original? %s\n", memcmp(raw, a, outlen) ? "no" : "YES"); - if(raw) - curl_free(raw); + curl_free(raw); /* deprecated API */ raw = curl_unescape(ptr, (int)strlen(ptr)); @@ -71,10 +69,8 @@ int test(char *URL) printf("[old] outlen == %d\n", outlen); printf("[old] unescape == original? %s\n", memcmp(raw, a, outlen) ? "no" : "YES"); - if(raw) - curl_free(raw); - if(ptr) - curl_free(ptr); + curl_free(raw); + curl_free(ptr); /* weird input length */ ptr = curl_easy_escape(NULL, (char *)a, -1); @@ -86,8 +82,7 @@ int test(char *URL) printf("unescape -1 length: %s %d\n", ptr, outlen); test_cleanup: - if(ptr) - curl_free(ptr); + curl_free(ptr); curl_global_cleanup(); return (int)res; diff --git a/tests/libtest/lib1554.c b/tests/libtest/lib1554.c index 8842ae2f7..df12fe52e 100644 --- a/tests/libtest/lib1554.c +++ b/tests/libtest/lib1554.c @@ -43,7 +43,6 @@ static void my_unlock(CURL *handle, curl_lock_data data, void *useptr) /* test function */ int test(char *URL) { - CURL *curl; CURLcode res = CURLE_OK; CURLSH *share; int i; @@ -65,7 +64,7 @@ int test(char *URL) still reuse connections since the pool is in the shared object! */ for(i = 0; i < 3; i++) { - curl = curl_easy_init(); + CURL *curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, URL); diff --git a/tests/libtest/lib1900.c b/tests/libtest/lib1900.c index 109c57062..cf55fb332 100644 --- a/tests/libtest/lib1900.c +++ b/tests/libtest/lib1900.c @@ -63,14 +63,14 @@ static int parse_url_file(const char *filename) return 0; while(!feof(f)) { - if(fscanf(f, "%d %s\n", &filetime, buf)) { + if(fscanf(f, "%d %199s\n", &filetime, buf)) { urltime[num_handles] = filetime; urlstring[num_handles] = strdup(buf); num_handles++; continue; } - if(fscanf(f, "blacklist_site %s\n", buf)) { + if(fscanf(f, "blacklist_site %199s\n", buf)) { site_blacklist[blacklist_num_sites] = strdup(buf); blacklist_num_sites++; continue; @@ -192,11 +192,11 @@ int test(char *URL) do { msg = curl_multi_info_read(m, &msgs_left); if(msg && msg->msg == CURLMSG_DONE) { - int i, found = 0; + int i; /* Find out which handle this message is about */ for(i = 0; i < num_handles; i++) { - found = (msg->easy_handle == handles[i]); + int found = (msg->easy_handle == handles[i]); if(found) break; } diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index 1b522be64..5ed4f37ea 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -131,7 +131,6 @@ static void *fire(void *ptr) struct curl_slist *headers; struct Tdata *tdata = (struct Tdata*)ptr; CURL *curl; - int i = 0; curl = curl_easy_init(); if(!curl) { @@ -149,6 +148,7 @@ static void *fire(void *ptr) printf("PERFORM\n"); code = curl_easy_perform(curl); if(code) { + int i = 0; fprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n", tdata->url, i, (int)code); } diff --git a/tests/libtest/lib512.c b/tests/libtest/lib512.c index 14241dd02..0c83ddd53 100644 --- a/tests/libtest/lib512.c +++ b/tests/libtest/lib512.c @@ -29,15 +29,13 @@ int test(char *URL) { CURLcode code; - CURL *curl; - CURL *curl2; int rc = 99; code = curl_global_init(CURL_GLOBAL_ALL); if(code == CURLE_OK) { - - curl = curl_easy_init(); + CURL *curl = curl_easy_init(); if(curl) { + CURL *curl2; curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_HEADER, 1L); diff --git a/tests/libtest/lib556.c b/tests/libtest/lib556.c index acb0f63d1..884f413aa 100644 --- a/tests/libtest/lib556.c +++ b/tests/libtest/lib556.c @@ -71,7 +71,6 @@ int test(char *URL) "Host: ninja\r\n\r\n"; #endif size_t iolen; - char buf[1024]; res = curl_easy_send(curl, request, strlen(request), &iolen); @@ -79,6 +78,7 @@ int test(char *URL) /* we assume that sending always work */ do { + char buf[1024]; /* busy-read like crazy */ res = curl_easy_recv(curl, buf, sizeof(buf), &iolen); diff --git a/tests/libtest/lib579.c b/tests/libtest/lib579.c index cba4b1cb4..4977a03cb 100644 --- a/tests/libtest/lib579.c +++ b/tests/libtest/lib579.c @@ -39,7 +39,6 @@ struct WriteThis { static int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) { - FILE *moo; static int prev_ultotal = -1; static int prev_ulnow = -1; (void)clientp; /* UNUSED */ @@ -53,7 +52,7 @@ static int progress_callback(void *clientp, double dltotal, double dlnow, if((prev_ultotal != (int)ultotal) || (prev_ulnow != (int)ulnow)) { - moo = fopen(libtest_arg2, "ab"); + FILE *moo = fopen(libtest_arg2, "ab"); if(moo) { fprintf(moo, "Progress callback called with UL %d out of %d\n", (int)ulnow, (int)ultotal); diff --git a/tests/libtest/lib586.c b/tests/libtest/lib586.c index 669f71c15..a831b83d4 100644 --- a/tests/libtest/lib586.c +++ b/tests/libtest/lib586.c @@ -99,7 +99,6 @@ static void *fire(void *ptr) CURLcode code; struct Tdata *tdata = (struct Tdata*)ptr; CURL *curl; - int i = 0; curl = curl_easy_init(); if(!curl) { @@ -116,6 +115,7 @@ static void *fire(void *ptr) printf("PERFORM\n"); code = curl_easy_perform(curl); if(code != CURLE_OK) { + int i = 0; fprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n", tdata->url, i, (int)code); } diff --git a/tests/libtest/testtrace.c b/tests/libtest/testtrace.c index 63e022b33..3f9eedd80 100644 --- a/tests/libtest/testtrace.c +++ b/tests/libtest/testtrace.c @@ -90,7 +90,6 @@ int libtest_debug_cb(CURL *handle, curl_infotype type, struct libtest_trace_cfg *trace_cfg = userp; const char *text; struct timeval tv; - struct tm *now; char timebuf[20]; char *timestr; time_t secs; @@ -101,6 +100,7 @@ int libtest_debug_cb(CURL *handle, curl_infotype type, timestr = &timebuf[0]; if(trace_cfg->tracetime) { + struct tm *now; tv = tutil_tvnow(); if(!known_offset) { epoch_offset = time(NULL) - tv.tv_sec; |