udp: Make rport calculation more local
cppcheck 2.14.1 complains about the rport variable not being in as small as scope as it could be. It's also only used once, so we might as well just open code the calculation for it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
d2afb4b625
commit
c80fa6a6bb
1 changed files with 1 additions and 2 deletions
3
udp.c
3
udp.c
|
@ -277,10 +277,9 @@ static void udp_invert_portmap(struct udp_fwd_ports *fwd)
|
||||||
"Forward and reverse delta arrays must have same size");
|
"Forward and reverse delta arrays must have same size");
|
||||||
for (i = 0; i < ARRAY_SIZE(fwd->f.delta); i++) {
|
for (i = 0; i < ARRAY_SIZE(fwd->f.delta); i++) {
|
||||||
in_port_t delta = fwd->f.delta[i];
|
in_port_t delta = fwd->f.delta[i];
|
||||||
in_port_t rport = i + delta;
|
|
||||||
|
|
||||||
if (delta)
|
if (delta)
|
||||||
fwd->rdelta[rport] = NUM_PORTS - delta;
|
fwd->rdelta[i + delta] = NUM_PORTS - delta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue