mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 13:34:38 +08:00
use memset and memcpy instead of bzero and bcopy throughout lwIP core code.Archs need to update.Bug #1899
This commit is contained in:
parent
219266b7de
commit
4c1069c38b
@ -508,7 +508,7 @@ struct dhcp_state *dhcp_start(struct netif *netif)
|
||||
DEBUGF(DHCP_DEBUG, ("dhcp_start(): could not allocate dhcp_state"));
|
||||
return NULL;
|
||||
}
|
||||
bzero(state, sizeof(struct dhcp_state));
|
||||
memset(state, 0, sizeof(struct dhcp_state));
|
||||
|
||||
DEBUGF(DHCP_DEBUG, ("dhcp_start(): allocated dhcp_state"));
|
||||
state->pcb = udp_new();
|
||||
@ -557,7 +557,7 @@ void dhcp_inform(struct netif *netif)
|
||||
DEBUGF(DHCP_DEBUG, ("dhcp_inform(): could not allocate dhcp_state"));
|
||||
return;
|
||||
}
|
||||
bzero(state, sizeof(struct dhcp_state));
|
||||
memset(state, 0, sizeof(struct dhcp_state));
|
||||
|
||||
DEBUGF(DHCP_DEBUG, ("dhcp_inform(): allocated dhcp_state"));
|
||||
state->pcb = udp_new();
|
||||
|
@ -156,7 +156,7 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
||||
ICMPH_TYPE_SET(idur, ICMP_DUR);
|
||||
ICMPH_CODE_SET(idur, t);
|
||||
|
||||
bcopy(p->payload, (char *)q->payload + 8, IP_HLEN + 8);
|
||||
memcpy((char *)q->payload + 8, p->payload, IP_HLEN + 8);
|
||||
|
||||
/* calculate checksum */
|
||||
idur->chksum = 0;
|
||||
@ -200,7 +200,7 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
|
||||
ICMPH_CODE_SET(tehdr, t);
|
||||
|
||||
/* copy fields from original packet */
|
||||
bcopy((char *)p->payload, (char *)q->payload + 8, IP_HLEN + 8);
|
||||
memcpy((char *)q->payload + 8, (char *)p->payload, IP_HLEN + 8);
|
||||
|
||||
/* calculate checksum */
|
||||
tehdr->chksum = 0;
|
||||
|
@ -62,7 +62,7 @@ copy_from_pbuf(struct pbuf *p, u16_t * offset,
|
||||
p->len -= *offset;
|
||||
while (len) {
|
||||
l = len < p->len ? len : p->len;
|
||||
bcopy(p->payload, buffer, l);
|
||||
memcpy(buffer, p->payload, l);
|
||||
buffer += l;
|
||||
len -= l;
|
||||
if (len)
|
||||
@ -112,12 +112,12 @@ ip_reass(struct pbuf *p)
|
||||
buffer. The timer is updated with the maximum age. */
|
||||
if (ip_reasstmr == 0) {
|
||||
DEBUGF(IP_REASS_DEBUG, ("ip_reass: new packet\n"));
|
||||
bcopy(fraghdr, iphdr, IP_HLEN);
|
||||
memcpy(iphdr, fraghdr, IP_HLEN);
|
||||
ip_reasstmr = IP_REASS_MAXAGE;
|
||||
sys_timeout(IP_REASS_TMO, (sys_timeout_handler) ip_reass_timer, NULL);
|
||||
ip_reassflags = 0;
|
||||
/* Clear the bitmap. */
|
||||
bzero(ip_reassbitmap, sizeof(ip_reassbitmap));
|
||||
memset(ip_reassbitmap, 0, sizeof(ip_reassbitmap));
|
||||
}
|
||||
|
||||
/* Check if the incoming fragment matches the one currently present
|
||||
@ -235,10 +235,10 @@ ip_reass(struct pbuf *p)
|
||||
avaliable data in the pbuf is given by the q->len
|
||||
variable. */
|
||||
DEBUGF(IP_REASS_DEBUG,
|
||||
("ip_reass: bcopy from %p (%d) to %p, %d bytes\n",
|
||||
("ip_reass: memcpy from %p (%d) to %p, %d bytes\n",
|
||||
&ip_reassbuf[i], i, q->payload,
|
||||
q->len > ip_reasslen - i ? ip_reasslen - i : q->len));
|
||||
bcopy(&ip_reassbuf[i], q->payload,
|
||||
memcpy(q->payload, &ip_reassbuf[i],
|
||||
q->len > ip_reasslen - i ? ip_reasslen - i : q->len);
|
||||
i += q->len;
|
||||
}
|
||||
@ -284,7 +284,7 @@ ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest)
|
||||
|
||||
/* Copy the IP header in it */
|
||||
iphdr = rambuf->payload;
|
||||
bcopy(p->payload, iphdr, IP_HLEN);
|
||||
memcpy(iphdr, p->payload, IP_HLEN);
|
||||
|
||||
/* Save original offset */
|
||||
tmp = ntohs(IPH_OFFSET(iphdr));
|
||||
|
@ -130,7 +130,7 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
||||
idur->type = (char)ICMP6_DUR;
|
||||
idur->icode = (char)t;
|
||||
|
||||
bcopy(p->payload, (char *)q->payload + 8, IP_HLEN + 8);
|
||||
memcpy((char *)q->payload + 8, p->payload, IP_HLEN + 8);
|
||||
|
||||
/* calculate checksum */
|
||||
idur->chksum = 0;
|
||||
@ -162,7 +162,7 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
|
||||
tehdr->icode = (char)t;
|
||||
|
||||
/* copy fields from original packet */
|
||||
bcopy((char *)p->payload, (char *)q->payload + 8, IP_HLEN + 8);
|
||||
memcpy((char *)q->payload + 8, (char *)p->payload, IP_HLEN + 8);
|
||||
|
||||
/* calculate checksum */
|
||||
tehdr->chksum = 0;
|
||||
|
@ -58,7 +58,7 @@ ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2)
|
||||
void
|
||||
ip_addr_set(struct ip_addr *dest, struct ip_addr *src)
|
||||
{
|
||||
bcopy(src, dest, sizeof(struct ip_addr));
|
||||
memcpy(dest, src, sizeof(struct ip_addr));
|
||||
/* dest->addr[0] = src->addr[0];
|
||||
dest->addr[1] = src->addr[1];
|
||||
dest->addr[2] = src->addr[2];
|
||||
|
@ -110,7 +110,7 @@ mem_init(void)
|
||||
{
|
||||
struct mem *mem;
|
||||
|
||||
bzero(ram, MEM_SIZE);
|
||||
memset(ram, 0, MEM_SIZE);
|
||||
mem = (struct mem *)ram;
|
||||
mem->next = MEM_SIZE;
|
||||
mem->prev = 0;
|
||||
@ -248,7 +248,7 @@ mem_reallocm(void *rmem, mem_size_t newsize)
|
||||
if(nmem == NULL) {
|
||||
return mem_realloc(rmem, newsize);
|
||||
}
|
||||
bcopy(rmem, nmem, newsize);
|
||||
memcpy(nmem, rmem, newsize);
|
||||
mem_free(rmem);
|
||||
return nmem;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ memp_malloc(memp_t type)
|
||||
|
||||
mem = MEM_ALIGN((u8_t *)memp + sizeof(struct memp));
|
||||
/* initialize memp memory with zeroes */
|
||||
bzero(mem, memp_sizes[type]);
|
||||
memset(mem, 0, memp_sizes[type]);
|
||||
return mem;
|
||||
} else {
|
||||
DEBUGF(MEMP_DEBUG, ("memp_malloc: out of memory in pool %d\n", type));
|
||||
|
@ -48,7 +48,7 @@ void
|
||||
stats_init(void)
|
||||
{
|
||||
#ifdef STATS
|
||||
bzero(&stats, sizeof(struct stats_));
|
||||
memset(&stats, 0, sizeof(struct stats_));
|
||||
#endif /* STATS */
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -709,7 +709,7 @@ tcp_seg_copy(struct tcp_seg *seg)
|
||||
if(cseg == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
bcopy((const char *)seg, (char *)cseg, sizeof(struct tcp_seg));
|
||||
memcpy((char *)cseg, (const char *)seg, sizeof(struct tcp_seg));
|
||||
pbuf_ref(cseg->p);
|
||||
return cseg;
|
||||
}
|
||||
@ -800,7 +800,7 @@ tcp_alloc(u8_t prio)
|
||||
}
|
||||
}
|
||||
if(pcb != NULL) {
|
||||
bzero(pcb, sizeof(struct tcp_pcb));
|
||||
memset(pcb, 0, sizeof(struct tcp_pcb));
|
||||
pcb->prio = TCP_PRIO_NORMAL;
|
||||
pcb->snd_buf = TCP_SND_BUF;
|
||||
pcb->snd_queuelen = 0;
|
||||
|
@ -167,7 +167,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
||||
}
|
||||
++queuelen;
|
||||
if(arg != NULL) {
|
||||
bcopy(ptr, seg->p->payload, seglen);
|
||||
memcpy(seg->p->payload, ptr, seglen);
|
||||
}
|
||||
seg->dataptr = seg->p->payload;
|
||||
} else {
|
||||
@ -222,7 +222,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
||||
/* Copy options into data portion of segment.
|
||||
Options can thus only be sent in non data carrying
|
||||
segments such as SYN|ACK. */
|
||||
bcopy(optdata, seg->dataptr, optlen);
|
||||
memcpy(seg->dataptr, optdata, optlen);
|
||||
}
|
||||
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: queueing %lu:%lu (0x%x)\n",
|
||||
ntohl(seg->tcphdr->seqno),
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: udp.c,v 1.3 2002/11/21 10:32:19 likewise Exp $
|
||||
* $Id: udp.c,v 1.4 2002/12/18 10:40:01 jani Exp $
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
@ -450,7 +450,7 @@ udp_new(void) {
|
||||
struct udp_pcb *pcb;
|
||||
pcb = memp_malloc(MEMP_UDP_PCB);
|
||||
if(pcb != NULL) {
|
||||
bzero(pcb, sizeof(struct udp_pcb));
|
||||
memset(pcb, 0, sizeof(struct udp_pcb));
|
||||
return pcb;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -55,7 +55,7 @@ loopif_output(struct netif *netif, struct pbuf *p,
|
||||
ptr = r->payload;
|
||||
|
||||
for(q = p; q != NULL; q = q->next) {
|
||||
bcopy(q->payload, ptr, q->len);
|
||||
memcpy(ptr, q->payload, q->len);
|
||||
ptr += q->len;
|
||||
}
|
||||
netif->input(r, netif);
|
||||
|
Loading…
x
Reference in New Issue
Block a user