Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Dec 2015 12:01:07 +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: r292595 - head/lib/libc/net
Message-ID:  <201512221201.tBMC174P088447@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ume
Date: Tue Dec 22 12:01:06 2015
New Revision: 292595
URL: https://svnweb.freebsd.org/changeset/base/292595

Log:
  We don't need to use a temporary buffer, here.
  
  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	Tue Dec 22 09:55:44 2015	(r292594)
+++ head/lib/libc/net/map_v4v6.c	Tue Dec 22 12:01:06 2015	(r292595)
@@ -78,15 +78,11 @@ typedef union {
 void
 _map_v4v6_address(const char *src, char *dst)
 {
-	char tmp[NS_INADDRSZ];
-
-	/* 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. */
-	memset(&dst[0], 0, 10);
 	memset(&dst[10], 0xff, 2);
-	/* Retrieve the saved copy and we're done. */
-	memcpy(&dst[12], tmp, NS_INADDRSZ);
+	memset(&dst[0], 0, 10);
 }
 
 void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512221201.tBMC174P088447>