mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-19 05:10:40 +00:00
minor: fixed coding style in ip4addr_aton()
This commit is contained in:
parent
dae73e21b8
commit
f89e859415
@ -167,8 +167,9 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
* Values are specified as for C:
|
||||
* 0x=hex, 0=octal, 1-9=decimal.
|
||||
*/
|
||||
if (!isdigit(c))
|
||||
if (!isdigit(c)) {
|
||||
return 0;
|
||||
}
|
||||
val = 0;
|
||||
base = 10;
|
||||
if (c == '0') {
|
||||
@ -176,9 +177,10 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
if (c == 'x' || c == 'X') {
|
||||
base = 16;
|
||||
c = *++cp;
|
||||
} else
|
||||
} else {
|
||||
base = 8;
|
||||
}
|
||||
}
|
||||
for (;;) {
|
||||
if (isdigit(c)) {
|
||||
val = (val * base) + (int)(c - '0');
|
||||
@ -186,9 +188,10 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
} else if (base == 16 && isxdigit(c)) {
|
||||
val = (val << 4) | (int)(c + 10 - (islower(c) ? 'a' : 'A'));
|
||||
c = *++cp;
|
||||
} else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (c == '.') {
|
||||
/*
|
||||
* Internet format:
|
||||
@ -201,9 +204,10 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
}
|
||||
*pp++ = val;
|
||||
c = *++cp;
|
||||
} else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Check for trailing characters.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user