Constified some arguments in local functions.
This commit is contained in:
parent
3fa6c51bb1
commit
d42eac4287
@ -66,7 +66,7 @@ static void addr_callback(void *arg, int status, int timeouts,
|
|||||||
static void end_aquery(struct addr_query *aquery, int status,
|
static void end_aquery(struct addr_query *aquery, int status,
|
||||||
struct hostent *host);
|
struct hostent *host);
|
||||||
static int file_lookup(struct ares_addr *addr, struct hostent **host);
|
static int file_lookup(struct ares_addr *addr, struct hostent **host);
|
||||||
static void ptr_rr_name(char *name, struct ares_addr *addr);
|
static void ptr_rr_name(char *name, const struct ares_addr *addr);
|
||||||
|
|
||||||
void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen,
|
void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen,
|
||||||
int family, ares_host_callback callback, void *arg)
|
int family, ares_host_callback callback, void *arg)
|
||||||
@ -252,7 +252,7 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ptr_rr_name(char *name, struct ares_addr *addr)
|
static void ptr_rr_name(char *name, const struct ares_addr *addr)
|
||||||
{
|
{
|
||||||
if (addr->family == AF_INET)
|
if (addr->family == AF_INET)
|
||||||
{
|
{
|
||||||
@ -267,7 +267,7 @@ static void ptr_rr_name(char *name, struct ares_addr *addr)
|
|||||||
{
|
{
|
||||||
unsigned char *bytes = (unsigned char *)&addr->addrV6.s6_addr;
|
unsigned char *bytes = (unsigned char *)&addr->addrV6.s6_addr;
|
||||||
/* There are too many arguments to do this in one line using
|
/* There are too many arguments to do this in one line using
|
||||||
* minimally C89-compliant compilers */
|
* minimally C89-compliant compilers */
|
||||||
sprintf(name,
|
sprintf(name,
|
||||||
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.",
|
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.",
|
||||||
bytes[15]&0xf, bytes[15] >> 4, bytes[14]&0xf, bytes[14] >> 4,
|
bytes[15]&0xf, bytes[15] >> 4, bytes[14]&0xf, bytes[14] >> 4,
|
||||||
|
@ -74,13 +74,13 @@ static void end_hquery(struct host_query *hquery, int status,
|
|||||||
static int fake_hostent(const char *name, int family, ares_host_callback callback,
|
static int fake_hostent(const char *name, int family, ares_host_callback callback,
|
||||||
void *arg);
|
void *arg);
|
||||||
static int file_lookup(const char *name, int family, struct hostent **host);
|
static int file_lookup(const char *name, int family, struct hostent **host);
|
||||||
static void sort_addresses(struct hostent *host, struct apattern *sortlist,
|
static void sort_addresses(struct hostent *host, const struct apattern *sortlist,
|
||||||
int nsort);
|
int nsort);
|
||||||
static void sort6_addresses(struct hostent *host, struct apattern *sortlist,
|
static void sort6_addresses(struct hostent *host, const struct apattern *sortlist,
|
||||||
int nsort);
|
int nsort);
|
||||||
static int get_address_index(struct in_addr *addr, struct apattern *sortlist,
|
static int get_address_index(const struct in_addr *addr, const struct apattern *sortlist,
|
||||||
int nsort);
|
int nsort);
|
||||||
static int get6_address_index(struct in6_addr *addr, struct apattern *sortlist,
|
static int get6_address_index(const struct in6_addr *addr, const struct apattern *sortlist,
|
||||||
int nsort);
|
int nsort);
|
||||||
|
|
||||||
void ares_gethostbyname(ares_channel channel, const char *name, int family,
|
void ares_gethostbyname(ares_channel channel, const char *name, int family,
|
||||||
@ -391,7 +391,7 @@ static int file_lookup(const char *name, int family, struct hostent **host)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sort_addresses(struct hostent *host, struct apattern *sortlist,
|
static void sort_addresses(struct hostent *host, const struct apattern *sortlist,
|
||||||
int nsort)
|
int nsort)
|
||||||
{
|
{
|
||||||
struct in_addr a1, a2;
|
struct in_addr a1, a2;
|
||||||
@ -421,7 +421,8 @@ static void sort_addresses(struct hostent *host, struct apattern *sortlist,
|
|||||||
/* Find the first entry in sortlist which matches addr. Return nsort
|
/* Find the first entry in sortlist which matches addr. Return nsort
|
||||||
* if none of them match.
|
* if none of them match.
|
||||||
*/
|
*/
|
||||||
static int get_address_index(struct in_addr *addr, struct apattern *sortlist,
|
static int get_address_index(const struct in_addr *addr,
|
||||||
|
const struct apattern *sortlist,
|
||||||
int nsort)
|
int nsort)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -446,7 +447,7 @@ static int get_address_index(struct in_addr *addr, struct apattern *sortlist,
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sort6_addresses(struct hostent *host, struct apattern *sortlist,
|
static void sort6_addresses(struct hostent *host, const struct apattern *sortlist,
|
||||||
int nsort)
|
int nsort)
|
||||||
{
|
{
|
||||||
struct in6_addr a1, a2;
|
struct in6_addr a1, a2;
|
||||||
@ -476,8 +477,9 @@ static void sort6_addresses(struct hostent *host, struct apattern *sortlist,
|
|||||||
/* Find the first entry in sortlist which matches addr. Return nsort
|
/* Find the first entry in sortlist which matches addr. Return nsort
|
||||||
* if none of them match.
|
* if none of them match.
|
||||||
*/
|
*/
|
||||||
static int get6_address_index(struct in6_addr *addr, struct apattern *sortlist,
|
static int get6_address_index(const struct in6_addr *addr,
|
||||||
int nsort)
|
const struct apattern *sortlist,
|
||||||
|
int nsort)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user