mirror of
https://github.com/curl/curl.git
synced 2026-08-02 16:20:28 +03:00
atoi: remove atoi usage
This commit is contained in:
parent
cbe67a1b71
commit
5db0a412ff
12 changed files with 36 additions and 22 deletions
|
|
@ -59,7 +59,10 @@ int main(int argc, char **argv)
|
|||
/* this enables the fail-on-alloc-number-N functionality */
|
||||
env = curl_getenv("CURL_MEMLIMIT");
|
||||
if(env) {
|
||||
curl_memlimit(atoi(env));
|
||||
char *endptr;
|
||||
long num = strtol(env, &endptr, 10);
|
||||
if((endptr != env) && (endptr == env + strlen(env)) && (num > 0))
|
||||
curl_memlimit(num);
|
||||
curl_free(env);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ int test(char *URL)
|
|||
}
|
||||
|
||||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_PORT, atoi(libtest_arg2));
|
||||
test_setopt(curl, CURLOPT_PORT, strtol(libtest_arg2, NULL, 10));
|
||||
test_setopt(curl, CURLOPT_USERPWD, "xxx:yyy");
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ int test(char *URL)
|
|||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
/* set port number */
|
||||
test_setopt(curl, CURLOPT_PORT, atoi(libtest_arg2) );
|
||||
test_setopt(curl, CURLOPT_PORT, strtol(libtest_arg2, NULL, 10));
|
||||
|
||||
/* specify target */
|
||||
test_setopt(curl,CURLOPT_URL, URL);
|
||||
|
|
|
|||
|
|
@ -531,8 +531,8 @@ static int ProcessRequest(struct httprequest *req)
|
|||
/* if the host name starts with test, the port number used in the
|
||||
CONNECT line will be used as test number! */
|
||||
char *portp = strchr(doc, ':');
|
||||
if(portp)
|
||||
req->testno = atoi(portp+1);
|
||||
if(portp && (*(portp+1) != '\0') && ISDIGIT(*(portp+1)))
|
||||
req->testno = strtol(portp+1, NULL, 10);
|
||||
else
|
||||
req->testno = DOCNUMBER_CONNECT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -467,8 +467,8 @@ static int ProcessRequest(struct httprequest *req)
|
|||
/* if the host name starts with test, the port number used in the
|
||||
CONNECT line will be used as test number! */
|
||||
char *portp = strchr(doc, ':');
|
||||
if(portp)
|
||||
req->testno = atoi(portp+1);
|
||||
if(portp && (*(portp+1) != '\0') && ISDIGIT(*(portp+1)))
|
||||
req->testno = strtol(portp+1, NULL, 10);
|
||||
else
|
||||
req->testno = DOCNUMBER_CONNECT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue