Commit e097312d authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Use local variables in for_all_*routes.

parent 13e80205
...@@ -320,9 +320,9 @@ flush_interface_routes(struct interface *ifp, int v4only) ...@@ -320,9 +320,9 @@ flush_interface_routes(struct interface *ifp, int v4only)
void void
for_all_routes(void (*f)(struct babel_route*, void*), void *closure) for_all_routes(void (*f)(struct babel_route*, void*), void *closure)
{ {
int i; int i, n = route_slots;
for(i = 0; i < route_slots; i++) { for(i = 0; i < n; i++) {
struct babel_route *r = routes[i]; struct babel_route *r = routes[i];
while(r) { while(r) {
(*f)(r, closure); (*f)(r, closure);
...@@ -334,9 +334,9 @@ for_all_routes(void (*f)(struct babel_route*, void*), void *closure) ...@@ -334,9 +334,9 @@ for_all_routes(void (*f)(struct babel_route*, void*), void *closure)
void void
for_all_installed_routes(void (*f)(struct babel_route*, void*), void *closure) for_all_installed_routes(void (*f)(struct babel_route*, void*), void *closure)
{ {
int i; int i, n = route_slots;
for(i = 0; i < route_slots; i++) { for(i = 0; i < n; i++) {
if(routes[i]->installed) if(routes[i]->installed)
(*f)(routes[i], closure); (*f)(routes[i], closure);
} }
......
...@@ -129,9 +129,9 @@ xroutes_estimate() ...@@ -129,9 +129,9 @@ xroutes_estimate()
void void
for_all_xroutes(void (*f)(struct xroute*, void*), void *closure) for_all_xroutes(void (*f)(struct xroute*, void*), void *closure)
{ {
int i; int i, n = numxroutes;
for(i = 0; i < numxroutes; i++) for(i = 0; i < n; i++)
(*f)(&xroutes[i], closure); (*f)(&xroutes[i], closure);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment