Use continue to advance to next iteration

This commit is contained in:
Martin Willi
2009-09-16 13:32:47 +02:00
parent 075448fbc8
commit 36b7ba5ee3
@@ -789,8 +789,9 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
return NULL; return NULL;
} }
this->mutex->lock(this->mutex); this->mutex->lock(this->mutex);
current = out;
while (NLMSG_OK(current, len)) for (current = out; NLMSG_OK(current, len);
current = NLMSG_NEXT(current, len))
{ {
switch (current->nlmsg_type) switch (current->nlmsg_type)
{ {
@@ -832,20 +833,20 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
} }
if (msg->rtm_dst_len <= best) if (msg->rtm_dst_len <= best)
{ /* not better than a previous one */ { /* not better than a previous one */
goto next; continue;
} }
if (this->routing_table != 0 && if (this->routing_table != 0 &&
msg->rtm_table == this->routing_table) msg->rtm_table == this->routing_table)
{ /* route is from our own ipsec routing table */ { /* route is from our own ipsec routing table */
goto next; continue;
} }
if (rta_oif && !is_interface_up(this, rta_oif)) if (rta_oif && !is_interface_up(this, rta_oif))
{ /* interface is down */ { /* interface is down */
goto next; continue;
} }
if (!addr_in_subnet(chunk, rta_dst, msg->rtm_dst_len)) if (!addr_in_subnet(chunk, rta_dst, msg->rtm_dst_len))
{ /* route destination does not contain dest */ { /* route destination does not contain dest */
goto next; continue;
} }
if (nexthop) if (nexthop)
@@ -857,7 +858,7 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
gtw = host_create_from_chunk(msg->rtm_family, rta_gtw, 0); gtw = host_create_from_chunk(msg->rtm_family, rta_gtw, 0);
best = msg->rtm_dst_len; best = msg->rtm_dst_len;
} }
goto next; continue;
} }
if (rta_src.ptr) if (rta_src.ptr)
{ {
@@ -873,7 +874,7 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
src = new_src; src = new_src;
best = msg->rtm_dst_len; best = msg->rtm_dst_len;
} }
goto next; continue;
} }
if (rta_gtw.ptr) if (rta_gtw.ptr)
{ /* no source, but a gateway. Lookup source to reach gtw. */ { /* no source, but a gateway. Lookup source to reach gtw. */
@@ -886,13 +887,11 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
src = new_src; src = new_src;
best = msg->rtm_dst_len; best = msg->rtm_dst_len;
} }
goto next; continue;
} }
goto next; continue;
} }
default: default:
next:
current = NLMSG_NEXT(current, len);
continue; continue;
} }
break; break;