Change all printf into PRINTA in uip-debug.c; remove compilation warning and move addr check after local variables definition in uip_debug_ipaddr_print

This commit is contained in:
Laurent Deru 2015-06-18 15:11:45 +02:00
parent d36e8adbdd
commit c73cd66a92

View file

@ -43,14 +43,16 @@
void void
uip_debug_ipaddr_print(const uip_ipaddr_t *addr) uip_debug_ipaddr_print(const uip_ipaddr_t *addr)
{ {
if(addr == NULL || addr->u8 == NULL) {
printf("(NULL IP addr)");
return;
}
#if NETSTACK_CONF_WITH_IPV6 #if NETSTACK_CONF_WITH_IPV6
uint16_t a; uint16_t a;
unsigned int i; unsigned int i;
int f; int f;
#endif /* NETSTACK_CONF_WITH_IPV6 */
if(addr == NULL) {
PRINTA("(NULL IP addr)");
return;
}
#if NETSTACK_CONF_WITH_IPV6
for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) { for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) {
a = (addr->u8[i] << 8) + addr->u8[i + 1]; a = (addr->u8[i] << 8) + addr->u8[i + 1];
if(a == 0 && f >= 0) { if(a == 0 && f >= 0) {
@ -76,7 +78,7 @@ uip_debug_lladdr_print(const uip_lladdr_t *addr)
{ {
unsigned int i; unsigned int i;
if(addr == NULL) { if(addr == NULL) {
printf("(NULL LL addr)"); PRINTA("(NULL LL addr)");
return; return;
} }
for(i = 0; i < sizeof(uip_lladdr_t); i++) { for(i = 0; i < sizeof(uip_lladdr_t); i++) {