summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2021-02-06 11:30:09 +0100
committerMarcel Raad <Marcel.Raad@teamviewer.com>2021-02-10 16:47:09 +0100
commit4c02d003ff581166d8adf43cd1606eaa4ace945d (patch)
tree6effa93b53ab990046701783acc99fb17d370e2c
parenta774b3f3042dd5122099e0bde5e799f158fddb24 (diff)
downloadcurl-4c02d003ff581166d8adf43cd1606eaa4ace945d.tar.gz
tests: reduce variable scopes
Closes https://github.com/curl/curl/pull/6576
-rw-r--r--tests/libtest/lib543.c7
-rw-r--r--tests/server/sws.c4
2 files changed, 4 insertions, 7 deletions
diff --git a/tests/libtest/lib543.c b/tests/libtest/lib543.c
index 39bcbad1c..c79295d2c 100644
--- a/tests/libtest/lib543.c
+++ b/tests/libtest/lib543.c
@@ -33,8 +33,6 @@ int test(char *URL)
0x1d, 0x57, 0xe1};
CURL *easy;
- int asize;
- char *s;
CURLcode res = CURLE_OK;
(void)URL;
@@ -45,9 +43,8 @@ int test(char *URL)
res = TEST_ERR_MAJOR_BAD;
}
else {
- asize = (int)sizeof(a);
-
- s = curl_easy_escape(easy, (const char *)a, asize);
+ int asize = (int)sizeof(a);
+ char *s = curl_easy_escape(easy, (const char *)a, asize);
if(s) {
printf("%s\n", s);
diff --git a/tests/server/sws.c b/tests/server/sws.c
index 74dd3a778..702560a4f 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -238,10 +238,10 @@ static bool socket_domain_is_ip(void)
/* parse the file on disk that might have a test number for us */
static int parse_cmdfile(struct httprequest *req)
{
- int testnum = DOCNUMBER_NOTHING;
- char buf[256];
FILE *f = fopen(cmdfile, FOPEN_READTEXT);
if(f) {
+ int testnum = DOCNUMBER_NOTHING;
+ char buf[256];
while(fgets(buf, sizeof(buf), f)) {
if(1 == sscanf(buf, "Testnum %d", &testnum)) {
logmsg("[%s] cmdfile says testnum %d", cmdfile, testnum);