svn commit: r245529 - user/ae/inet6/sys/netinet6
Gleb Smirnoff
glebius at FreeBSD.org
Thu Jan 17 09:39:32 UTC 2013
On Thu, Jan 17, 2013 at 02:30:32AM +0000, Andrey V. Elsukov wrote:
A> Author: ae
A> Date: Thu Jan 17 02:30:32 2013
A> New Revision: 245529
A> URL: http://svnweb.freebsd.org/changeset/base/245529
A>
A> Log:
A> Use M_ZERO flag instead of explicit bzero call after malloc.
A>
A> Modified:
A> user/ae/inet6/sys/netinet6/in6.c
A>
A> Modified: user/ae/inet6/sys/netinet6/in6.c
A> ==============================================================================
A> --- user/ae/inet6/sys/netinet6/in6.c Thu Jan 17 02:23:40 2013 (r245528)
A> +++ user/ae/inet6/sys/netinet6/in6.c Thu Jan 17 02:30:32 2013 (r245529)
A> @@ -2703,17 +2703,13 @@ in6_domifattach(struct ifnet *ifp)
A> {
A> struct in6_ifextra *ext;
A>
A> - ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR, M_WAITOK);
A> - bzero(ext, sizeof(*ext));
A> -
A> - ext->in6_ifstat = (struct in6_ifstat *)malloc(sizeof(struct in6_ifstat),
A> - M_IFADDR, M_WAITOK);
A> - bzero(ext->in6_ifstat, sizeof(*ext->in6_ifstat));
A> -
A> + ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR,
A> + M_WAITOK | M_ZERO);
A> + ext->in6_ifstat = (struct in6_ifstat *)malloc(
A> + sizeof(struct in6_ifstat), M_IFADDR, M_WAITOK | M_ZERO);
A> ext->icmp6_ifstat =
A> (struct icmp6_ifstat *)malloc(sizeof(struct icmp6_ifstat),
A> - M_IFADDR, M_WAITOK);
A> - bzero(ext->icmp6_ifstat, sizeof(*ext->icmp6_ifstat));
A> + M_IFADDR, M_WAITOK | M_ZERO);
A>
A> ext->nd_ifinfo = nd6_ifattach(ifp);
A> ext->scope6_id = scope6_ifattach(ifp);
A> @@ -2723,10 +2719,9 @@ in6_domifattach(struct ifnet *ifp)
A> ext->lltable->llt_lookup = in6_lltable_lookup;
A> ext->lltable->llt_dump = in6_lltable_dump;
A> }
A> -
A> ext->mld_ifinfo = mld_domifattach(ifp);
A>
A> - return ext;
A> + return (ext);
A> }
A>
A> void
Since your commit improves style(9), you could also remove casts before malloc().
--
Totus tuus, Glebius.
More information about the svn-src-user
mailing list