]> granicus.if.org Git - php/commitdiff
Use memset instead of brace initialization
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 12 Jun 2019 11:25:19 +0000 (13:25 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 12 Jun 2019 11:50:23 +0000 (13:50 +0200)
Apparently {{0}} is not enough ... let's not rely on structure
layout specifics here.

ext/sockets/multicast.c

index 2ede92bc6e8c2a47a14ed5a7493644bdbed148e9..e874803656439afaf35979f031388d68753dc2fe 100644 (file)
@@ -463,8 +463,9 @@ static int _php_mcast_join_leave(
                        sizeof(greq));
 #else
        if (sock->type == AF_INET) {
-               struct ip_mreq mreq = {{0}};
+               struct ip_mreq mreq;
                struct in_addr addr;
+               memset(&mreq, 0, sizeof(struct ip_mreq));
 
                assert(group_len == sizeof(struct sockaddr_in));
 
@@ -483,7 +484,8 @@ static int _php_mcast_join_leave(
        }
 #if HAVE_IPV6
        else if (sock->type == AF_INET6) {
-               struct ipv6_mreq mreq = {{0}};
+               struct ipv6_mreq mreq;
+               memset(&mreq, 0, sizeof(struct ipv6_mreq));
 
                assert(group_len == sizeof(struct sockaddr_in6));