atoi: remove atoi usage

pull/2/head
Yang Tse 14 years ago
parent 0ea27cdbbf
commit e3f7230dc2
  1. 14
      ares_init.c
  2. 4
      ares_options.c

@ -129,8 +129,12 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
if (env)
curl_memdebug(env);
env = getenv("CARES_MEMLIMIT");
if (env)
curl_memlimit(atoi(env));
if (env) {
char *endptr;
long num = strtol(env, &endptr, 10);
if((endptr != env) && (endptr == env + strlen(env)) && (num > 0))
curl_memlimit(num);
}
#endif
if (ares_library_initialized() != ARES_SUCCESS)
@ -1396,13 +1400,13 @@ static int set_options(ares_channel channel, const char *str)
q++;
val = try_option(p, q, "ndots:");
if (val && channel->ndots == -1)
channel->ndots = atoi(val);
channel->ndots = (int)strtol(val, NULL, 10);
val = try_option(p, q, "retrans:");
if (val && channel->timeout == -1)
channel->timeout = atoi(val);
channel->timeout = (int)strtol(val, NULL, 10);
val = try_option(p, q, "retry:");
if (val && channel->tries == -1)
channel->tries = atoi(val);
channel->tries = (int)strtol(val, NULL, 10);
val = try_option(p, q, "rotate");
if (val && channel->rotate == -1)
channel->rotate = 1;

@ -139,7 +139,7 @@ int ares_set_servers_csv(ares_channel channel,
char* csv = NULL;
char* ptr;
char* start_host;
int port;
long port;
bool found_port;
int rv = ARES_SUCCESS;
struct ares_addr_node *servers = NULL;
@ -188,7 +188,7 @@ int ares_set_servers_csv(ares_channel channel,
if ((pp != start_host) && ((pp + 1) < ptr)) {
/* Found it. */
found_port = true;
port = atoi(pp + 1);
port = strtol(pp + 1, NULL, 10);
*pp = 0; /* null terminate host */
}
/* resolve host, try ipv4 first, rslt is in network byte order */

Loading…
Cancel
Save