Constify 'hostname' and 'service' to various resolver functions.
This commit is contained in:
parent
02938a010d
commit
a55c70d4ae
@ -259,7 +259,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
|||||||
* Curl_freeaddrinfo(), nothing else.
|
* Curl_freeaddrinfo(), nothing else.
|
||||||
*/
|
*/
|
||||||
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||||
char *hostname,
|
const char *hostname,
|
||||||
int port,
|
int port,
|
||||||
int *waitp)
|
int *waitp)
|
||||||
{
|
{
|
||||||
@ -314,7 +314,7 @@ struct namebuf {
|
|||||||
* The input parameters ARE NOT checked for validity but they are expected
|
* The input parameters ARE NOT checked for validity but they are expected
|
||||||
* to have been checked already when this is called.
|
* 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;
|
Curl_addrinfo *ai;
|
||||||
struct hostent *h;
|
struct hostent *h;
|
||||||
|
@ -196,7 +196,7 @@ const char *Curl_printable_address(const Curl_addrinfo *ip,
|
|||||||
* the DNS caching.
|
* the DNS caching.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
create_hostcache_id(char *server, int port)
|
create_hostcache_id(const char *server, int port)
|
||||||
{
|
{
|
||||||
/* create and return the new allocated entry */
|
/* create and return the new allocated entry */
|
||||||
return aprintf("%s:%d", server, port);
|
return aprintf("%s:%d", server, port);
|
||||||
@ -327,7 +327,7 @@ sigjmp_buf curl_jmpenv;
|
|||||||
struct Curl_dns_entry *
|
struct Curl_dns_entry *
|
||||||
Curl_cache_addr(struct SessionHandle *data,
|
Curl_cache_addr(struct SessionHandle *data,
|
||||||
Curl_addrinfo *addr,
|
Curl_addrinfo *addr,
|
||||||
char *hostname,
|
const char *hostname,
|
||||||
int port)
|
int port)
|
||||||
{
|
{
|
||||||
char *entry_id;
|
char *entry_id;
|
||||||
@ -344,7 +344,7 @@ Curl_cache_addr(struct SessionHandle *data,
|
|||||||
entry_len = strlen(entry_id);
|
entry_len = strlen(entry_id);
|
||||||
|
|
||||||
/* Create a new cache entry */
|
/* 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) {
|
if (!dns) {
|
||||||
free(entry_id);
|
free(entry_id);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -394,7 +394,7 @@ Curl_cache_addr(struct SessionHandle *data,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int Curl_resolv(struct connectdata *conn,
|
int Curl_resolv(struct connectdata *conn,
|
||||||
char *hostname,
|
const char *hostname,
|
||||||
int port,
|
int port,
|
||||||
struct Curl_dns_entry **entry)
|
struct Curl_dns_entry **entry)
|
||||||
{
|
{
|
||||||
|
10
lib/hostip.h
10
lib/hostip.h
@ -135,7 +135,7 @@ struct Curl_dns_entry {
|
|||||||
#define CURLRESOLV_ERROR -1
|
#define CURLRESOLV_ERROR -1
|
||||||
#define CURLRESOLV_RESOLVED 0
|
#define CURLRESOLV_RESOLVED 0
|
||||||
#define CURLRESOLV_PENDING 1
|
#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);
|
int port, struct Curl_dns_entry **dnsentry);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -151,7 +151,7 @@ bool Curl_ipvalid(struct SessionHandle *data);
|
|||||||
* of arguments
|
* of arguments
|
||||||
*/
|
*/
|
||||||
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||||
char *hostname,
|
const char *hostname,
|
||||||
int port,
|
int port,
|
||||||
int *waitp);
|
int *waitp);
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ int Curl_num_addresses (const Curl_addrinfo *addr);
|
|||||||
#ifdef CURLDEBUG
|
#ifdef CURLDEBUG
|
||||||
void curl_dofreeaddrinfo(struct addrinfo *freethis,
|
void curl_dofreeaddrinfo(struct addrinfo *freethis,
|
||||||
int line, const char *source);
|
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 *hints,
|
||||||
struct addrinfo **result,
|
struct addrinfo **result,
|
||||||
int line, const char *source);
|
int line, const char *source);
|
||||||
@ -220,7 +220,7 @@ CURLcode Curl_addrinfo6_callback(void *arg,
|
|||||||
|
|
||||||
/* [ipv4 only] Creates a Curl_addrinfo struct from a numerical-only IP
|
/* [ipv4 only] Creates a Curl_addrinfo struct from a numerical-only IP
|
||||||
address */
|
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
|
/* [ipv4 only] Curl_he2ai() converts a struct hostent to a Curl_addrinfo chain
|
||||||
and returns it */
|
and returns it */
|
||||||
@ -247,7 +247,7 @@ const char *Curl_printable_address(const Curl_addrinfo *ip,
|
|||||||
*/
|
*/
|
||||||
struct Curl_dns_entry *
|
struct Curl_dns_entry *
|
||||||
Curl_cache_addr(struct SessionHandle *data, Curl_addrinfo *addr,
|
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.
|
* Curl_destroy_thread_data() cleans up async resolver data.
|
||||||
|
@ -139,7 +139,7 @@ struct namebuf {
|
|||||||
* The input parameters ARE NOT checked for validity but they are expected
|
* The input parameters ARE NOT checked for validity but they are expected
|
||||||
* to have been checked already when this is called.
|
* 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;
|
Curl_addrinfo *ai;
|
||||||
struct hostent *h;
|
struct hostent *h;
|
||||||
@ -185,7 +185,7 @@ Curl_addrinfo *Curl_ip2addr(in_addr_t num, char *hostname, int port)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||||
char *hostname,
|
const char *hostname,
|
||||||
int port,
|
int port,
|
||||||
int *waitp)
|
int *waitp)
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,7 @@ Curl_addrinfo *Curl_addrinfo_copy(void *source, int port)
|
|||||||
* family otherwise present in memdebug.c. I put these ones here since they
|
* 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
|
* 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 *hints,
|
||||||
struct addrinfo **result,
|
struct addrinfo **result,
|
||||||
int line, const char *source)
|
int line, const char *source)
|
||||||
@ -222,7 +222,7 @@ static void dump_addrinfo(struct connectdata *conn, const struct addrinfo *ai)
|
|||||||
* Curl_freeaddrinfo(), nothing else.
|
* Curl_freeaddrinfo(), nothing else.
|
||||||
*/
|
*/
|
||||||
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||||
char *hostname,
|
const char *hostname,
|
||||||
int port,
|
int port,
|
||||||
int *waitp)
|
int *waitp)
|
||||||
{
|
{
|
||||||
|
@ -726,7 +726,7 @@ int Curl_resolv_getsock(struct connectdata *conn,
|
|||||||
* Curl_getaddrinfo() - for Windows threading without ENABLE_IPV6.
|
* Curl_getaddrinfo() - for Windows threading without ENABLE_IPV6.
|
||||||
*/
|
*/
|
||||||
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||||
char *hostname,
|
const char *hostname,
|
||||||
int port,
|
int port,
|
||||||
int *waitp)
|
int *waitp)
|
||||||
{
|
{
|
||||||
@ -766,7 +766,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
|||||||
* Curl_getaddrinfo() - for Windows threading IPv6 enabled
|
* Curl_getaddrinfo() - for Windows threading IPv6 enabled
|
||||||
*/
|
*/
|
||||||
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||||
char *hostname,
|
const char *hostname,
|
||||||
int port,
|
int port,
|
||||||
int *waitp)
|
int *waitp)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user