summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2015-12-21 16:55:36 +0000
committerume <ume@FreeBSD.org>2015-12-21 16:55:36 +0000
commite93f3f0c71917233d6e21e3fd05e1520d2d84984 (patch)
tree3665f33a5d0c736bc4f8d67eabebe28f492c8554 /lib/libc
parentf410c06c4a6cb96c531b5c8794bbe94d1b592d7c (diff)
downloadFreeBSD-src-e93f3f0c71917233d6e21e3fd05e1520d2d84984.zip
FreeBSD-src-e93f3f0c71917233d6e21e3fd05e1520d2d84984.tar.gz
Simplify _map_v4v6_address().
Suggested by: hrs MFC after: 1 week
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/map_v4v6.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/libc/net/map_v4v6.c b/lib/libc/net/map_v4v6.c
index 09b035b..5cfe817 100644
--- a/lib/libc/net/map_v4v6.c
+++ b/lib/libc/net/map_v4v6.c
@@ -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
OpenPOWER on IntegriCloud