about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-11-21 00:33:33 +0000
committerUlrich Drepper <drepper@redhat.com>2006-11-21 00:33:33 +0000
commitdfc99a56514db15abe8e00aface9cd2be831f447 (patch)
tree415c1514f15c0300743c174dd076988f0ec7b87c
parent852d657c229b33d7aa2d0a0509459b73e17eacbe (diff)
downloadglibc-dfc99a56514db15abe8e00aface9cd2be831f447.tar.gz
glibc-dfc99a56514db15abe8e00aface9cd2be831f447.tar.xz
glibc-dfc99a56514db15abe8e00aface9cd2be831f447.zip
* resolv/mapv4v6addr.h (map_v4v6_address): Optimize a bit.
-rw-r--r--ChangeLog4
-rw-r--r--resolv/mapv4v6addr.h10
2 files changed, 8 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 7eb3ae0d7c..f4c0a0a6e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-11-20  Ulrich Drepper  <drepper@redhat.com>
+
+	* resolv/mapv4v6addr.h (map_v4v6_address): Optimize a bit.
+
 2006-11-18  Bruno Haible  <bruno@clisp.org>
 
 	* sysdeps/unix/sysv/linux/i386/getgroups.c (__getgroups): Invoke
diff --git a/resolv/mapv4v6addr.h b/resolv/mapv4v6addr.h
index bc3290f162..a71a6cc1a7 100644
--- a/resolv/mapv4v6addr.h
+++ b/resolv/mapv4v6addr.h
@@ -56,16 +56,14 @@ static void
 map_v4v6_address (const char *src, char *dst)
 {
   u_char *p = (u_char *) dst;
-  char tmp[INADDRSZ];
   int i;
 
-  /* Stash a temporary copy so our caller can update in place. */
-  memcpy (tmp, src, INADDRSZ);
+  /* Move the IPv4 part to the right position.  */
+  memcpy (src + 12, src, 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, INADDRSZ);
+  *p = 0xff;
 }