mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Megacommit of many files.
Mostly, several functions that take pointers as arguments, almost always char * pointers, had those pointers qualified with "const". Those that returned pointers to previously const-qualified arguments had their return values qualified as const. Some structure members were qualified as const to retain that attribute from the variables from which they were assigned. The macro DE_CONST was added to isc/util.h to deal with a handful of very special places where something is qualified as const but really needs to have its const qualifier removed. Also cleaned up a few places where variable names clashed with reserved identifiers. (Which mostly works fine, but strictly speaking is undefined by the standard.) Minor other ISC style cleanups.
This commit is contained in:
@@ -141,10 +141,12 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
|
||||
if (1 + plen + 1 > isc_buffer_availablelength(target))
|
||||
return (ISC_R_NOSPACE);
|
||||
|
||||
isc_buffer_putmem(target, (unsigned char *)"#", 1);
|
||||
isc_buffer_putmem(target, (unsigned char *)pbuf, plen);
|
||||
isc_buffer_putmem(target, (const unsigned char *)"#", 1);
|
||||
isc_buffer_putmem(target, (const unsigned char *)pbuf, plen);
|
||||
|
||||
/* Null terminate after used region. */
|
||||
/*
|
||||
* Null terminate after used region.
|
||||
*/
|
||||
isc_buffer_availableregion(target, &avail);
|
||||
INSIST(avail.length >= 1);
|
||||
avail.base[0] = '\0';
|
||||
@@ -185,18 +187,19 @@ isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) {
|
||||
case AF_INET:
|
||||
return (ntohl(sockaddr->type.sin.sin_addr.s_addr));
|
||||
case AF_INET6:
|
||||
s = (unsigned char *)&sockaddr->type.sin6.sin6_addr;
|
||||
s = (const unsigned char *)&sockaddr->
|
||||
type.sin6.sin6_addr;
|
||||
length = sizeof sockaddr->type.sin6.sin6_addr;
|
||||
break;
|
||||
default:
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"unknown address family: %d",
|
||||
(int)sockaddr->type.sa.sa_family);
|
||||
s = (unsigned char *)&sockaddr->type;
|
||||
s = (const unsigned char *)&sockaddr->type;
|
||||
length = sockaddr->length;
|
||||
}
|
||||
} else {
|
||||
s = (unsigned char *)&sockaddr->type;
|
||||
s = (const unsigned char *)&sockaddr->type;
|
||||
length = sockaddr->length;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user