minor: fixed coding style in ip4addr_aton()

This commit is contained in:
goldsimon 2015-09-30 14:13:05 +02:00
parent dae73e21b8
commit f89e859415

View File

@ -167,8 +167,9 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
* Values are specified as for C: * Values are specified as for C:
* 0x=hex, 0=octal, 1-9=decimal. * 0x=hex, 0=octal, 1-9=decimal.
*/ */
if (!isdigit(c)) if (!isdigit(c)) {
return 0; return 0;
}
val = 0; val = 0;
base = 10; base = 10;
if (c == '0') { if (c == '0') {
@ -176,8 +177,9 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
if (c == 'x' || c == 'X') { if (c == 'x' || c == 'X') {
base = 16; base = 16;
c = *++cp; c = *++cp;
} else } else {
base = 8; base = 8;
}
} }
for (;;) { for (;;) {
if (isdigit(c)) { if (isdigit(c)) {
@ -186,8 +188,9 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
} else if (base == 16 && isxdigit(c)) { } else if (base == 16 && isxdigit(c)) {
val = (val << 4) | (int)(c + 10 - (islower(c) ? 'a' : 'A')); val = (val << 4) | (int)(c + 10 - (islower(c) ? 'a' : 'A'));
c = *++cp; c = *++cp;
} else } else {
break; break;
}
} }
if (c == '.') { if (c == '.') {
/* /*
@ -201,8 +204,9 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
} }
*pp++ = val; *pp++ = val;
c = *++cp; c = *++cp;
} else } else {
break; break;
}
} }
/* /*
* Check for trailing characters. * Check for trailing characters.