mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
sizeof style
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: socket.c,v 1.10 2001/11/27 00:56:23 gson Exp $ */
|
||||
/* $Id: socket.c,v 1.11 2001/11/27 01:56:22 gson Exp $ */
|
||||
|
||||
|
||||
#define MAKE_EXTERNAL 1
|
||||
@@ -429,7 +429,7 @@ socket_log(isc_socket_t *sock, isc_sockaddr_t *address,
|
||||
msgcat, msgset, message,
|
||||
"socket %p: %s", sock, msgbuf);
|
||||
} else {
|
||||
isc_sockaddr_format(address, peerbuf, sizeof peerbuf);
|
||||
isc_sockaddr_format(address, peerbuf, sizeof(peerbuf));
|
||||
isc_log_iwrite(isc_lctx, category, module, level,
|
||||
msgcat, msgset, message,
|
||||
"socket %p %s: %s", sock, peerbuf, msgbuf);
|
||||
@@ -707,7 +707,7 @@ build_msghdr_send(isc_socket_t *sock, isc_socketevent_t *dev,
|
||||
UNUSED(cmsg);
|
||||
#endif
|
||||
|
||||
memset(msg, 0, sizeof (*msg));
|
||||
memset(msg, 0, sizeof(*msg));
|
||||
|
||||
if (sock->type == isc_sockettype_udp) {
|
||||
msg->msg_name = (void *)&dev->address.type.sa;
|
||||
@@ -826,7 +826,7 @@ build_msghdr_recv(isc_socket_t *sock, isc_socketevent_t *dev,
|
||||
UNUSED(cmsg);
|
||||
#endif
|
||||
|
||||
memset(msg, 0, sizeof (struct msghdr));
|
||||
memset(msg, 0, sizeof(struct msghdr));
|
||||
|
||||
if (sock->type == isc_sockettype_udp) {
|
||||
memset(&dev->address, 0, sizeof(dev->address));
|
||||
@@ -937,7 +937,7 @@ allocate_socketevent(isc_socket_t *sock, isc_eventtype_t eventtype,
|
||||
ev = (isc_socketevent_t *)isc_event_allocate(sock->manager->mctx,
|
||||
sock, eventtype,
|
||||
action, arg,
|
||||
sizeof (*ev));
|
||||
sizeof(*ev));
|
||||
|
||||
if (ev == NULL)
|
||||
return (NULL);
|
||||
@@ -1283,7 +1283,7 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
|
||||
isc_socket_t *sock;
|
||||
isc_result_t ret;
|
||||
|
||||
sock = isc_mem_get(manager->mctx, sizeof *sock);
|
||||
sock = isc_mem_get(manager->mctx, sizeof(*sock));
|
||||
|
||||
if (sock == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
@@ -1373,7 +1373,7 @@ free_socket(isc_socket_t **socketp) {
|
||||
|
||||
DESTROYLOCK(&sock->lock);
|
||||
|
||||
isc_mem_put(sock->manager->mctx, sock, sizeof *sock);
|
||||
isc_mem_put(sock->manager->mctx, sock, sizeof(*sock));
|
||||
|
||||
*socketp = NULL;
|
||||
}
|
||||
@@ -1457,7 +1457,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
|
||||
#ifdef SO_BSDCOMPAT
|
||||
if (setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT,
|
||||
(void *)&on, sizeof on) < 0) {
|
||||
(void *)&on, sizeof(on)) < 0) {
|
||||
socket_errno = WSAGetLastError();
|
||||
isc__strerror(socket_errno, strbuf, sizeof(strbuf));
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
@@ -1475,7 +1475,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
|
||||
#if defined(SO_TIMESTAMP)
|
||||
if (setsockopt(sock->fd, SOL_SOCKET, SO_TIMESTAMP,
|
||||
(void *)&on, sizeof on) < 0
|
||||
(void *)&on, sizeof(on)) < 0
|
||||
&& WSAGetLastError() != WSAENOPROTOOPT) {
|
||||
isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf));
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
@@ -1495,7 +1495,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
/* 2292bis */
|
||||
if ((pf == AF_INET6)
|
||||
&& (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_RECVPKTINFO,
|
||||
(void *)&on, sizeof (on)) < 0)) {
|
||||
(void *)&on, sizeof(on)) < 0)) {
|
||||
isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf));
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"setsockopt(%d, IPV6_RECVPKTINFO) "
|
||||
@@ -1510,7 +1510,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
/* 2292 */
|
||||
if ((pf == AF_INET6)
|
||||
&& (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_PKTINFO,
|
||||
(void *)&on, sizeof (on)) < 0)) {
|
||||
(void *)&on, sizeof(on)) < 0)) {
|
||||
isc__strerror(WSAGetLaastError(), strbuf, sizeof(strbuf));
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"setsockopt(%d, IPV6_PKTINFO) %s: %s",
|
||||
@@ -1527,7 +1527,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
if (pf == AF_INET6) {
|
||||
(void)setsockopt(sock->fd, IPPROTO_IPV6,
|
||||
IPV6_USE_MIN_MTU,
|
||||
(void *)&on, sizeof (on));
|
||||
(void *)&on, sizeof(on));
|
||||
}
|
||||
#endif
|
||||
#endif /* ISC_PLATFORM_HAVEIPV6 */
|
||||
@@ -1822,7 +1822,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
||||
* EAGAIN or EINTR, simply poke the watcher to watch this socket
|
||||
* again.
|
||||
*/
|
||||
addrlen = sizeof dev->newsocket->address.type;
|
||||
addrlen = sizeof(dev->newsocket->address.type);
|
||||
memset(&dev->newsocket->address.type.sa, 0, addrlen);
|
||||
fd = accept(sock->fd, &dev->newsocket->address.type.sa,
|
||||
(void *)&addrlen);
|
||||
@@ -2284,7 +2284,7 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
}
|
||||
#endif /* ISC_PLATFORM_USETHREADS */
|
||||
|
||||
manager = isc_mem_get(mctx, sizeof *manager);
|
||||
manager = isc_mem_get(mctx, sizeof(*manager));
|
||||
if (manager == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
@@ -2293,7 +2293,7 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
memset(manager->fds, 0, sizeof(manager->fds));
|
||||
ISC_LIST_INIT(manager->socklist);
|
||||
if (isc_mutex_init(&manager->lock) != ISC_R_SUCCESS) {
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
isc_mem_put(mctx, manager, sizeof(*manager));
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_mutex_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
@@ -2302,7 +2302,7 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
}
|
||||
if (isc_condition_init(&manager->shutdown_ok) != ISC_R_SUCCESS) {
|
||||
DESTROYLOCK(&manager->lock);
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
isc_mem_put(mctx, manager, sizeof(*manager));
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_condition_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
@@ -2316,7 +2316,7 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
*/
|
||||
if (internal_pipe(manager->pipe_fds) != 0) {
|
||||
DESTROYLOCK(&manager->lock);
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
isc_mem_put(mctx, manager, sizeof(*manager));
|
||||
isc__strerror(errno, strbuf, sizeof(strbuf));
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"pipe() %s: %s",
|
||||
@@ -2343,7 +2343,7 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
if (isc_thread_create(watcher, manager, &manager->watcher) !=
|
||||
ISC_R_SUCCESS) {
|
||||
DESTROYLOCK(&manager->lock);
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
isc_mem_put(mctx, manager, sizeof(*manager));
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_thread_create() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
@@ -2443,7 +2443,7 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
DESTROYLOCK(&manager->lock);
|
||||
manager->magic = 0;
|
||||
mctx= manager->mctx;
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
isc_mem_put(mctx, manager, sizeof(*manager));
|
||||
|
||||
isc_mem_detach(&mctx);
|
||||
|
||||
@@ -2834,7 +2834,7 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
|
||||
return (ISC_R_FAMILYMISMATCH);
|
||||
}
|
||||
if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
|
||||
sizeof on) < 0) {
|
||||
sizeof(on)) < 0) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"setsockopt(%d) %s", sock->fd,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
@@ -2938,7 +2938,7 @@ isc_socket_accept(isc_socket_t *sock,
|
||||
*/
|
||||
dev = (isc_socket_newconnev_t *)
|
||||
isc_event_allocate(manager->mctx, task, ISC_SOCKEVENT_NEWCONN,
|
||||
action, arg, sizeof (*dev));
|
||||
action, arg, sizeof(*dev));
|
||||
if (dev == NULL) {
|
||||
UNLOCK(&sock->lock);
|
||||
return (ISC_R_NOMEMORY);
|
||||
@@ -3008,7 +3008,7 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
|
||||
dev = (isc_socket_connev_t *)isc_event_allocate(manager->mctx, sock,
|
||||
ISC_SOCKEVENT_CONNECT,
|
||||
action, arg,
|
||||
sizeof (*dev));
|
||||
sizeof(*dev));
|
||||
if (dev == NULL) {
|
||||
UNLOCK(&sock->lock);
|
||||
return (ISC_R_NOMEMORY);
|
||||
@@ -3244,7 +3244,7 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
|
||||
ret = ISC_R_SUCCESS;
|
||||
|
||||
len = sizeof addressp->type;
|
||||
len = sizeof(addressp->type);
|
||||
if (getsockname(sock->fd, &addressp->type.sa, (void *)&len) < 0) {
|
||||
isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf));
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__, "getsockname: %s",
|
||||
|
Reference in New Issue
Block a user