summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2015-12-29 00:42:35 +0000
committerume <ume@FreeBSD.org>2015-12-29 00:42:35 +0000
commit8dfa514cac3d4d5ea56e3fdb2f700bfd6750b8a6 (patch)
treedf15a9a4c6350ac8784825d097cccd42a0896e29 /lib
parent113fbc51614b9d1c6c59058c966e50e4ace42e48 (diff)
downloadFreeBSD-src-8dfa514cac3d4d5ea56e3fdb2f700bfd6750b8a6.zip
FreeBSD-src-8dfa514cac3d4d5ea56e3fdb2f700bfd6750b8a6.tar.gz
MFC r292550, r292595:
Simplify _map_v4v6_address(). We don't need to use a temporary buffer, here.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/map_v4v6.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/libc/net/map_v4v6.c b/lib/libc/net/map_v4v6.c
index dbc7e70..871cfda 100644
--- a/lib/libc/net/map_v4v6.c
+++ b/lib/libc/net/map_v4v6.c
@@ -77,19 +77,11 @@ 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);
+ /* Our caller may update in place. */
+ memmove(&dst[12], src, NS_INADDRSZ);
/* Mark this ipv6 addr as a mapped ipv4. */
- for (i = 0; i < 10; i++)
- *p++ = 0x00;
- *p++ = 0xff;
- *p++ = 0xff;
- /* Retrieve the saved copy and we're done. */
- memcpy((void*)p, tmp, NS_INADDRSZ);
+ memset(&dst[10], 0xff, 2);
+ memset(&dst[0], 0, 10);
}
void
OpenPOWER on IntegriCloud