Skip to content

Commit 3cc4048

Browse files
committed
ipv4: Remove dead code in ip4addr_aton()
Use a default case with an assertion to get rid of dead code.
1 parent 9db462a commit 3cc4048

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/core/ipv4/ip4_addr.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,8 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
216216
*/
217217
switch (pp - parts + 1) {
218218

219-
case 0:
220-
return 0; /* initial nondigit */
221-
222-
case 1: /* a -- 32 bits */
219+
default: /* a -- 32 bits */
220+
LWIP_ASSERT("unhandled", pp == parts);
223221
break;
224222

225223
case 2: /* a.b -- 8.24 bits */
@@ -251,9 +249,6 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
251249
}
252250
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
253251
break;
254-
default:
255-
LWIP_ASSERT("unhandled", 0);
256-
break;
257252
}
258253
if (addr) {
259254
ip4_addr_set_u32(addr, lwip_htonl(val));

0 commit comments

Comments
 (0)