Date: Mon, 21 Dec 2015 16:55:37 +0000 (UTC) From: Hajimu UMEMOTO <ume@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292550 - head/lib/libc/net Message-ID: <201512211655.tBLGtbxi024720@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ume Date: Mon Dec 21 16:55:36 2015 New Revision: 292550 URL: https://svnweb.freebsd.org/changeset/base/292550 Log: Simplify _map_v4v6_address(). Suggested by: hrs MFC after: 1 week Modified: head/lib/libc/net/map_v4v6.c Modified: head/lib/libc/net/map_v4v6.c ============================================================================== --- head/lib/libc/net/map_v4v6.c Mon Dec 21 16:12:41 2015 (r292549) +++ head/lib/libc/net/map_v4v6.c Mon Dec 21 16:55:36 2015 (r292550) @@ -78,19 +78,15 @@ typedef union { void _map_v4v6_address(const char *src, char *dst) { - u_char *p = (u_char *)dst; char tmp[NS_INADDRSZ]; - int i; /* Stash a temporary copy so our caller can update in place. */ memcpy(tmp, src, NS_INADDRSZ); /* Mark this ipv6 addr as a mapped ipv4. */ - for (i = 0; i < 10; i++) - *p++ = 0x00; - *p++ = 0xff; - *p++ = 0xff; + memset(&dst[0], 0, 10); + memset(&dst[10], 0xff, 2); /* Retrieve the saved copy and we're done. */ - memcpy((void*)p, tmp, NS_INADDRSZ); + memcpy(&dst[12], tmp, NS_INADDRSZ); } void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512211655.tBLGtbxi024720>