Skip to content

Commit

Permalink
Use nullptr/std::addressof
Browse files Browse the repository at this point in the history
    * ACE/ace/SOCK_Dgram.cpp:
  • Loading branch information
jwillemsen committed Sep 19, 2023
1 parent 28f307f commit 1f9ea6a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions ACE/ace/SOCK_Dgram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ ACE_SOCK_Dgram::send (const iovec iov[],

// Recv an iovec of size N to ADDR as a datagram (connectionless
// version).

ssize_t
ACE_SOCK_Dgram::recv (iovec iov[],
int n,
Expand Down Expand Up @@ -346,16 +345,14 @@ ACE_SOCK_Dgram::recv (iovec iov[],
recv_msg.msg_namelen = addr.get_size ();

#ifdef ACE_USE_MSG_CONTROL
recv_msg.msg_control = to_addr ? &cbuf : 0;
recv_msg.msg_control = to_addr ? std::addressof(cbuf) : nullptr;
recv_msg.msg_controllen = to_addr ? sizeof (cbuf) : 0;
#elif !defined ACE_LACKS_SENDMSG
recv_msg.msg_accrights = 0;
recv_msg.msg_accrights = nullptr;
recv_msg.msg_accrightslen = 0;
#endif

ssize_t status = ACE_OS::recvmsg (this->get_handle (),
&recv_msg,
flags);
ssize_t const status = ACE_OS::recvmsg (this->get_handle (), std::addressof(recv_msg), flags);
addr.set_size (recv_msg.msg_namelen);
addr.set_type (((sockaddr_in *) addr.get_addr())->sin_family);

Expand Down Expand Up @@ -404,8 +401,8 @@ ACE_SOCK_Dgram::recv (iovec iov[],

#else /* ACE_HAS_MSG */

// Send an iovec of size N to ADDR as a datagram (connectionless
// version).
/// Send an iovec of size N to ADDR as a datagram (connectionless
/// version).
ssize_t
ACE_SOCK_Dgram::send (const iovec iov[],
int n,
Expand Down Expand Up @@ -489,7 +486,7 @@ ACE_SOCK_Dgram::recv (iovec iov[],
#endif
length += iov[i].iov_len;

char *buf = 0;
char *buf = nullptr;

#if defined (ACE_HAS_ALLOCA)
buf = alloca (length);
Expand Down

0 comments on commit 1f9ea6a

Please sign in to comment.