mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-08 00:23:39 +08:00
Included patch #5920: Create define to override C-library memcpy. 2 Defines are created: MEMCPY() for normal memcpy, SMEMCPY() for situations where some compilers might inline the copy and save a function call. Also replaced all calls to memcpy() with calls to (S)MEMCPY().
This commit is contained in:
@@ -576,8 +576,8 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
|
||||
|
||||
/* Copy struct ip_addr2 to aligned ip_addr, to support compilers without
|
||||
* structure packing (not using structure copy which breaks strict-aliasing rules). */
|
||||
memcpy(&sipaddr, &hdr->sipaddr, sizeof(sipaddr));
|
||||
memcpy(&dipaddr, &hdr->dipaddr, sizeof(dipaddr));
|
||||
SMEMCPY(&sipaddr, &hdr->sipaddr, sizeof(sipaddr));
|
||||
SMEMCPY(&dipaddr, &hdr->dipaddr, sizeof(dipaddr));
|
||||
|
||||
/* this interface is not configured? */
|
||||
if (netif->ip_addr.addr == 0) {
|
||||
|
||||
@@ -114,7 +114,7 @@ loopif_output(struct netif *netif, struct pbuf *p,
|
||||
*/
|
||||
ptr = r->payload;
|
||||
for(q = p; q != NULL; q = q->next) {
|
||||
memcpy(ptr, q->payload, q->len);
|
||||
MEMCPY(ptr, q->payload, q->len);
|
||||
ptr += q->len;
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ void MD5Final (unsigned char hash[], MD5_CTX *mdContext)
|
||||
mdContext->digest[ii+3] =
|
||||
(unsigned char)((mdContext->buf[i] >> 24) & 0xFF);
|
||||
}
|
||||
memcpy(hash, mdContext->digest, 16);
|
||||
SMEMCPY(hash, mdContext->digest, 16);
|
||||
}
|
||||
|
||||
/* Basic MD5 step. Transforms buf based on in.
|
||||
|
||||
@@ -840,7 +840,7 @@ void ppp_send_config(
|
||||
*/
|
||||
void ppp_set_xaccm(int unit, ext_accm *accm)
|
||||
{
|
||||
memcpy(pppControl[unit].outACCM, accm, sizeof(ext_accm));
|
||||
SMEMCPY(pppControl[unit].outACCM, accm, sizeof(ext_accm));
|
||||
PPPDEBUG((LOG_INFO, "ppp_set_xaccm[%d]: outACCM=%X %X %X %X\n",
|
||||
unit,
|
||||
pppControl[unit].outACCM[0],
|
||||
@@ -1075,11 +1075,11 @@ int sifaddr(
|
||||
st = 0;
|
||||
PPPDEBUG((LOG_WARNING, "sifup[%d]: bad parms\n", pd));
|
||||
} else {
|
||||
memcpy(&pc->addrs.our_ipaddr, &o, sizeof(o));
|
||||
memcpy(&pc->addrs.his_ipaddr, &h, sizeof(h));
|
||||
memcpy(&pc->addrs.netmask, &m, sizeof(m));
|
||||
memcpy(&pc->addrs.dns1, &ns1, sizeof(ns1));
|
||||
memcpy(&pc->addrs.dns2, &ns2, sizeof(ns2));
|
||||
SMEMCPY(&pc->addrs.our_ipaddr, &o, sizeof(o));
|
||||
SMEMCPY(&pc->addrs.his_ipaddr, &h, sizeof(h));
|
||||
SMEMCPY(&pc->addrs.netmask, &m, sizeof(m));
|
||||
SMEMCPY(&pc->addrs.dns1, &ns1, sizeof(ns1));
|
||||
SMEMCPY(&pc->addrs.dns2, &ns2, sizeof(ns2));
|
||||
}
|
||||
return st;
|
||||
}
|
||||
@@ -1269,7 +1269,7 @@ static struct pbuf *pppSingleBuf(struct pbuf *p)
|
||||
}
|
||||
|
||||
for(b = p, pl = q->payload; b != NULL; b = b->next) {
|
||||
memcpy(pl, b->payload, b->len);
|
||||
MEMCPY(pl, b->payload, b->len);
|
||||
pl += b->len;
|
||||
}
|
||||
|
||||
@@ -1394,7 +1394,7 @@ static void pppInput(void *arg)
|
||||
}
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
protocol = htons(protocol);
|
||||
memcpy(nb->payload, &protocol, sizeof(protocol));
|
||||
SMEMCPY(nb->payload, &protocol, sizeof(protocol));
|
||||
#endif
|
||||
lcp_sprotrej(pd, nb->payload, nb->len);
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ enum NPmode {
|
||||
#define DECPTR(n, cp) ((cp) -= (n))
|
||||
|
||||
#define BCMP(s0, s1, l) memcmp((u_char *)(s0), (u_char *)(s1), (l))
|
||||
#define BCOPY(s, d, l) memcpy((d), (s), (l))
|
||||
#define BCOPY(s, d, l) MEMCPY((d), (s), (l))
|
||||
#define BZERO(s, n) memset(s, 0, n)
|
||||
#if PPP_DEBUG
|
||||
#define PRINTMSG(m, l) { m[l] = '\0'; ppp_trace(LOG_INFO, "Remote message: %s\n", m); }
|
||||
|
||||
@@ -127,7 +127,7 @@ void avGenRand(char *buf, u32_t bufLen)
|
||||
MD5Update(&md5, (u_char *)&randCount, sizeof(randCount));
|
||||
MD5Final(tmp, &md5);
|
||||
randCount++;
|
||||
memcpy(buf, tmp, n);
|
||||
MEMCPY(buf, tmp, n);
|
||||
buf += n;
|
||||
bufLen -= n;
|
||||
}
|
||||
|
||||
@@ -605,7 +605,7 @@ int vj_uncompress_tcp(
|
||||
|
||||
bufptr = n0->payload;
|
||||
for(q = np; q != NULL; q = q->next) {
|
||||
memcpy(q->payload, bufptr, q->len);
|
||||
MEMCPY(q->payload, bufptr, q->len);
|
||||
bufptr += q->len;
|
||||
}
|
||||
|
||||
@@ -631,7 +631,7 @@ int vj_uncompress_tcp(
|
||||
n0 = np;
|
||||
}
|
||||
LWIP_ASSERT("n0->len >= cs->cs_hlen", n0->len >= cs->cs_hlen);
|
||||
memcpy(n0->payload, &cs->cs_ip, cs->cs_hlen);
|
||||
MEMCPY(n0->payload, &cs->cs_ip, cs->cs_hlen);
|
||||
|
||||
*nb = n0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user