aboutgitcodebugslistschat
path: root/udp.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-06-06 20:09:42 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-06-07 20:44:44 +0200
commitc80fa6a6bb4415ad48f9e11424310875d0d99bc7 (patch)
tree2b24f2fd5566ebecf96bc3945b2fba17cdef643d /udp.c
parentd2afb4b6254ceb3d5a86c24eede93d186b927a29 (diff)
downloadpasst-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>
Diffstat (limited to 'udp.c')
-rw-r--r--udp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/udp.c b/udp.c
index 3abafc9..61e106a 100644
--- a/udp.c
+++ b/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");
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;
}
}