Add uip_clear_buf() macro and replace all instances of uip_len = 0; with it

This commit is contained in:
Laurent Deru 2015-06-15 10:25:58 +02:00
parent cb09689846
commit 1784338b2e
30 changed files with 92 additions and 84 deletions

View file

@ -538,8 +538,7 @@ remove_ext_hdr(void)
uip_ext_len, uip_len);
if(uip_len < UIP_IPH_LEN + uip_ext_len) {
PRINTF("ERROR: uip_len too short compared to ext len\n");
uip_ext_len = 0;
uip_len = 0;
uip_clear_buf();
return;
}
memmove(((uint8_t *)UIP_TCP_BUF), (uint8_t *)UIP_TCP_BUF + uip_ext_len,
@ -825,8 +824,7 @@ uip_reass_over(void)
* any RFC, we decided not to include it as it reduces the size of
* the packet.
*/
uip_len = 0;
uip_ext_len = 0;
uip_clear_buf();
memcpy(UIP_IP_BUF, FBUF, UIP_IPH_LEN); /* copy the header for src
and dest address*/
uip_icmp6_error_output(ICMP6_TIME_EXCEEDED, ICMP6_TIME_EXCEED_REASSEMBLY, 0);
@ -971,7 +969,7 @@ uip_process(uint8_t flag)
} else if(flag == UIP_TIMER) {
/* Reset the length variables. */
#if UIP_TCP
uip_len = 0;
uip_clear_buf();
uip_slen = 0;
/* Increase the initial sequence number. */
@ -1456,7 +1454,7 @@ uip_process(uint8_t flag)
UIP_STAT(++uip_stat.icmp.drop);
UIP_STAT(++uip_stat.icmp.typeerr);
UIP_LOG("icmp6: unknown ICMPv6 message.");
uip_len = 0;
uip_clear_buf();
}
if(uip_len > 0) {
@ -1978,7 +1976,7 @@ uip_process(uint8_t flag)
uip_add_rcv_nxt(1);
uip_flags = UIP_CONNECTED | UIP_NEWDATA;
uip_connr->len = 0;
uip_len = 0;
uip_clear_buf();
uip_slen = 0;
UIP_APPCALL();
goto appsend;
@ -2310,8 +2308,7 @@ uip_process(uint8_t flag)
return;
drop:
uip_len = 0;
uip_ext_len = 0;
uip_clear_buf();
uip_ext_bitmap = 0;
uip_flags = 0;
return;