[PATCH 2/4] ws2_32: Remove outer preprocessor checks from control message functions

Alex Henrie alexhenrie24 at gmail.com
Mon Sep 27 09:40:22 CDT 2021


The checks were ugly and unnecessary. Furthermore, these functions are
used for both IPv4 and IPv6 options, and it's conceivable that a system
could be stripped down to only provide IPv6 support and not IPv4
support.

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/ntdll/unix/socket.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c
index 75c54295c20..2be4f2b52a3 100644
--- a/dlls/ntdll/unix/socket.c
+++ b/dlls/ntdll/unix/socket.c
@@ -369,7 +369,6 @@ static int sockaddr_from_unix( const union unix_sockaddr *uaddr, struct WS_socka
 }
 
 #ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
-#if defined(IP_PKTINFO) || defined(IP_RECVDSTADDR)
 static WSACMSGHDR *fill_control_message( int level, int type, WSACMSGHDR *current, ULONG *maxsize, void *data, int len )
 {
     ULONG msgsize = sizeof(WSACMSGHDR) + WSA_CMSG_ALIGN(len);
@@ -384,11 +383,9 @@ static WSACMSGHDR *fill_control_message( int level, int type, WSACMSGHDR *curren
     memcpy(ptr, data, len);
     return (WSACMSGHDR *)(ptr + WSA_CMSG_ALIGN(len));
 }
-#endif /* defined(IP_PKTINFO) || defined(IP_RECVDSTADDR) */
 
 static int convert_control_headers(struct msghdr *hdr, WSABUF *control)
 {
-#if defined(IP_PKTINFO) || defined(IP_RECVDSTADDR)
     WSACMSGHDR *cmsg_win = (WSACMSGHDR *)control->buf, *ptr;
     ULONG ctlsize = control->len;
     struct cmsghdr *cmsg_unix;
@@ -490,10 +487,6 @@ static int convert_control_headers(struct msghdr *hdr, WSABUF *control)
 error:
     control->len = 0;
     return 0;
-#else /* defined(IP_PKTINFO) || defined(IP_RECVDSTADDR) */
-    control->len = 0;
-    return 1;
-#endif /* defined(IP_PKTINFO) || defined(IP_RECVDSTADDR) */
 }
 #endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
 
-- 
2.33.0




More information about the wine-devel mailing list