Skip to content

Commit

Permalink
tests: reduce variable scopes
Browse files Browse the repository at this point in the history
Closes curl#6576
  • Loading branch information
MarcelRaad committed Feb 10, 2021
1 parent a774b3f commit 4c02d00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions tests/libtest/lib543.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ int test(char *URL)
0x1d, 0x57, 0xe1};

CURL *easy;
int asize;
char *s;
CURLcode res = CURLE_OK;
(void)URL;

Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions tests/server/sws.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4c02d00

Please sign in to comment.