1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Prefer assignment to memcpy when either will do.

* lib-src/pop.c (socket_connection) [HAVE_GETADDRINFO]:
* src/bidi.c (bidi_push_it, bidi_pop_it):
* src/fns.c (copy_hash_table):
* src/image.c (define_image_type):
* src/keyboard.c (kbd_buffer_store_event_hold):
* src/process.c (Fprocess_send_eof):
* src/xfaces.c (x_create_gc) [HAVE_NS]:
* src/xgselect.c (xg_select):
Use assignment, not memcpy, as either will do here, and assignment is
more likely to catch type errors.
This commit is contained in:
Paul Eggert 2012-09-11 15:59:50 -07:00
parent 5779a1dc62
commit ae1d87e24e
10 changed files with 25 additions and 12 deletions

View file

@ -1,3 +1,8 @@
2012-09-11 Paul Eggert <eggert@cs.ucla.edu>
* pop.c (socket_connection) [HAVE_GETADDRINFO]:
Prefer assignment to memcpy when either will do.
2012-08-31 Andreas Schwab <schwab@linux-m68k.org>
* etags.c (consider_token): Always zero-terminate token buffer.

View file

@ -1083,7 +1083,7 @@ socket_connection (char *host, int flags)
if (it->ai_addrlen == sizeof (addr))
{
struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr;
memcpy (&addr.sin_addr, &in_a->sin_addr, sizeof (addr.sin_addr));
addr.sin_addr = in_a->sin_addr;
if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
break;
}