Skip to content

Commit cdefeb7

Browse files
committed
Use memset instead of brace initialization
Apparently {{0}} is not enough ... let's not rely on structure layout specifics here.
1 parent 945e5d3 commit cdefeb7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/sockets/multicast.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,9 @@ static int _php_mcast_join_leave(
463463
sizeof(greq));
464464
#else
465465
if (sock->type == AF_INET) {
466-
struct ip_mreq mreq = {{0}};
466+
struct ip_mreq mreq;
467467
struct in_addr addr;
468+
memset(&mreq, 0, sizeof(struct ip_mreq));
468469

469470
assert(group_len == sizeof(struct sockaddr_in));
470471

@@ -483,7 +484,8 @@ static int _php_mcast_join_leave(
483484
}
484485
#if HAVE_IPV6
485486
else if (sock->type == AF_INET6) {
486-
struct ipv6_mreq mreq = {{0}};
487+
struct ipv6_mreq mreq;
488+
memset(&mreq, 0, sizeof(struct ipv6_mreq));
487489

488490
assert(group_len == sizeof(struct sockaddr_in6));
489491

0 commit comments

Comments
 (0)