* Curl_freeaddrinfo(), nothing else.
*/
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
- char *hostname,
+ const char *hostname,
int port,
int *waitp)
{
* The input parameters ARE NOT checked for validity but they are expected
* to have been checked already when this is called.
*/
-Curl_addrinfo *Curl_ip2addr(in_addr_t num, char *hostname, int port)
+Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port)
{
Curl_addrinfo *ai;
struct hostent *h;
* the DNS caching.
*/
static char *
-create_hostcache_id(char *server, int port)
+create_hostcache_id(const char *server, int port)
{
/* create and return the new allocated entry */
return aprintf("%s:%d", server, port);
struct Curl_dns_entry *
Curl_cache_addr(struct SessionHandle *data,
Curl_addrinfo *addr,
- char *hostname,
+ const char *hostname,
int port)
{
char *entry_id;
entry_len = strlen(entry_id);
/* Create a new cache entry */
- dns = (struct Curl_dns_entry *) malloc(sizeof(struct Curl_dns_entry));
+ dns = (struct Curl_dns_entry *) calloc(sizeof(struct Curl_dns_entry), 1);
if (!dns) {
free(entry_id);
return NULL;
*/
int Curl_resolv(struct connectdata *conn,
- char *hostname,
+ const char *hostname,
int port,
struct Curl_dns_entry **entry)
{
#define CURLRESOLV_ERROR -1
#define CURLRESOLV_RESOLVED 0
#define CURLRESOLV_PENDING 1
-int Curl_resolv(struct connectdata *conn, char *hostname,
+int Curl_resolv(struct connectdata *conn, const char *hostname,
int port, struct Curl_dns_entry **dnsentry);
/*
* of arguments
*/
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
- char *hostname,
+ const char *hostname,
int port,
int *waitp);
#ifdef CURLDEBUG
void curl_dofreeaddrinfo(struct addrinfo *freethis,
int line, const char *source);
-int curl_dogetaddrinfo(char *hostname, char *service,
+int curl_dogetaddrinfo(const char *hostname, const char *service,
struct addrinfo *hints,
struct addrinfo **result,
int line, const char *source);
/* [ipv4 only] Creates a Curl_addrinfo struct from a numerical-only IP
address */
-Curl_addrinfo *Curl_ip2addr(in_addr_t num, char *hostname, int port);
+Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port);
/* [ipv4 only] Curl_he2ai() converts a struct hostent to a Curl_addrinfo chain
and returns it */
*/
struct Curl_dns_entry *
Curl_cache_addr(struct SessionHandle *data, Curl_addrinfo *addr,
- char *hostname, int port);
+ const char *hostname, int port);
/*
* Curl_destroy_thread_data() cleans up async resolver data.
* The input parameters ARE NOT checked for validity but they are expected
* to have been checked already when this is called.
*/
-Curl_addrinfo *Curl_ip2addr(in_addr_t num, char *hostname, int port)
+Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port)
{
Curl_addrinfo *ai;
struct hostent *h;
*
*/
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
- char *hostname,
+ const char *hostname,
int port,
int *waitp)
{
* family otherwise present in memdebug.c. I put these ones here since they
* require a bunch of structs I didn't wanna include in memdebug.c
*/
-int curl_dogetaddrinfo(char *hostname, char *service,
+int curl_dogetaddrinfo(const char *hostname, const char *service,
struct addrinfo *hints,
struct addrinfo **result,
int line, const char *source)
* Curl_freeaddrinfo(), nothing else.
*/
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
- char *hostname,
+ const char *hostname,
int port,
int *waitp)
{
* Curl_getaddrinfo() - for Windows threading without ENABLE_IPV6.
*/
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
- char *hostname,
+ const char *hostname,
int port,
int *waitp)
{
* Curl_getaddrinfo() - for Windows threading IPv6 enabled
*/
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
- char *hostname,
+ const char *hostname,
int port,
int *waitp)
{