mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 13:34:38 +08:00
Fix gcc warning per discussion on lwip-users 2006.04.25: dereferencing
type-punned pointer will break strict-aliasing rules. Use memcpy instead of structure copy; code is not in critical path.
This commit is contained in:
parent
076a884651
commit
0148128881
@ -488,9 +488,10 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
|
|||||||
|
|
||||||
hdr = p->payload;
|
hdr = p->payload;
|
||||||
|
|
||||||
/* get aligned copies of addresses */
|
/* Copy struct ip_addr2 to aligned ip_addr, to support compilers without
|
||||||
*(struct ip_addr2 *)&sipaddr = hdr->sipaddr;
|
* structure packing (not using structure copy which breaks strict-aliasing rules). */
|
||||||
*(struct ip_addr2 *)&dipaddr = hdr->dipaddr;
|
memcpy(&sipaddr, &hdr->sipaddr, sizeof(sipaddr));
|
||||||
|
memcpy(&dipaddr, &hdr->dipaddr, sizeof(dipaddr));
|
||||||
|
|
||||||
/* this interface is not configured? */
|
/* this interface is not configured? */
|
||||||
if (netif->ip_addr.addr == 0) {
|
if (netif->ip_addr.addr == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user