1
0
mirror of https://git.code.sf.net/p/mingw-w64/mingw-w64 synced 2025-04-18 17:44:18 +03:00

crt: Avoid memset calls in libsrc/ws2tcpip.

In preparation for building the CRT with -fno-builtin. This allows the compiler
to zero memory without making an actual library call.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
This commit is contained in:
Jacek Caban 2025-03-22 12:27:35 +01:00
parent d4b6d1d4ab
commit 475fc9674e
4 changed files with 3 additions and 13 deletions

View File

@ -8,6 +8,6 @@
void IN6_SET_ADDR_LOOPBACK(struct in6_addr *a)
{
memset(a->s6_bytes, 0, sizeof(struct in6_addr));
*a = (struct in6_addr){0};
a->s6_bytes[15] = 1;
}

View File

@ -8,5 +8,5 @@
void IN6_SET_ADDR_UNSPECIFIED(struct in6_addr *a)
{
memset(a->s6_bytes, 0, sizeof(struct in6_addr));
*a = (struct in6_addr){0};
}

View File

@ -6,14 +6,11 @@
#include <winsock2.h>
#include <ws2tcpip.h>
#undef IN6_SET_ADDR_UNSPECIFIED
#define IN6_SET_ADDR_UNSPECIFIED(a) memset((a)->s6_bytes,0,sizeof(struct in6_addr))
void IN6ADDR_SETANY(struct sockaddr_in6 *a)
{
a->sin6_family = AF_INET6;
a->sin6_port = 0;
a->sin6_flowinfo = 0;
IN6_SET_ADDR_UNSPECIFIED(&a->sin6_addr);
a->sin6_addr = (struct in6_addr){0};
a->sin6_scope_id = 0;
}

View File

@ -6,13 +6,6 @@
#include <winsock2.h>
#include <ws2tcpip.h>
#undef IN6_SET_ADDR_LOOPBACK
#define IN6_SET_ADDR_LOOPBACK(a) \
do { \
memset((a)->s6_bytes,0,sizeof(struct in6_addr));\
(a)->s6_bytes[15] = 1; \
} while (0)
void IN6ADDR_SETLOOPBACK(struct sockaddr_in6 *a)
{
a->sin6_family = AF_INET6;