Skip to content

Commit

Permalink
* resolv/mapv4v6addr.h (map_v4v6_address): Optimize a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Nov 21, 2006
1 parent 852d657 commit dfc99a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 4 additions & 6 deletions resolv/mapv4v6addr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit dfc99a5

Please sign in to comment.