]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: reduce variable scopes
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Sat, 6 Feb 2021 10:30:09 +0000 (11:30 +0100)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Wed, 10 Feb 2021 15:47:09 +0000 (16:47 +0100)
Closes https://github.com/curl/curl/pull/6576

tests/libtest/lib543.c
tests/server/sws.c

index 39bcbad1c2ed7414d089d955f97710952aa24774..c79295d2c1379d7953ec95c6fac895309e9479de 100644 (file)
@@ -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);
index 74dd3a778cadb3e97887b8eb0804cd870e6b2d6b..702560a4ff8f78a667a6b09ee0539c2916645d4e 100644 (file)
@@ -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);