diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-06-06 20:09:42 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-06-07 20:44:44 +0200 |
commit | c80fa6a6bb4415ad48f9e11424310875d0d99bc7 (patch) | |
tree | 2b24f2fd5566ebecf96bc3945b2fba17cdef643d | |
parent | d2afb4b6254ceb3d5a86c24eede93d186b927a29 (diff) | |
download | passt-c80fa6a6bb4415ad48f9e11424310875d0d99bc7.tar passt-c80fa6a6bb4415ad48f9e11424310875d0d99bc7.tar.gz passt-c80fa6a6bb4415ad48f9e11424310875d0d99bc7.tar.bz2 passt-c80fa6a6bb4415ad48f9e11424310875d0d99bc7.tar.lz passt-c80fa6a6bb4415ad48f9e11424310875d0d99bc7.tar.xz passt-c80fa6a6bb4415ad48f9e11424310875d0d99bc7.tar.zst passt-c80fa6a6bb4415ad48f9e11424310875d0d99bc7.zip |
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>
-rw-r--r-- | udp.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -277,10 +277,9 @@ static void udp_invert_portmap(struct udp_fwd_ports *fwd) "Forward and reverse delta arrays must have same size"); for (i = 0; i < ARRAY_SIZE(fwd->f.delta); i++) { in_port_t delta = fwd->f.delta[i]; - in_port_t rport = i + delta; if (delta) - fwd->rdelta[rport] = NUM_PORTS - delta; + fwd->rdelta[i + delta] = NUM_PORTS - delta; } } |