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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to