aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-02-20 13:48:23 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-02-20 08:14:08 +0100
commit8954c4a91b98b734797c3d1292d6635d917fa4d8 (patch)
tree4f3d52141dc632d9d0e1e594e61f26b145fde6c8
parentff22a78d7b5235403163969cfa294dfb2293c4c6 (diff)
downloadpasst-8954c4a91b98b734797c3d1292d6635d917fa4d8.tar
passt-8954c4a91b98b734797c3d1292d6635d917fa4d8.tar.gz
passt-8954c4a91b98b734797c3d1292d6635d917fa4d8.tar.bz2
passt-8954c4a91b98b734797c3d1292d6635d917fa4d8.tar.lz
passt-8954c4a91b98b734797c3d1292d6635d917fa4d8.tar.xz
passt-8954c4a91b98b734797c3d1292d6635d917fa4d8.tar.zst
passt-8954c4a91b98b734797c3d1292d6635d917fa4d8.zip
udp: Assertion in udp_invert_portmap() can be calculated at compile time
All the values in this ASSERT() are known at compile time, so this can be converted to a static_assert(). Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--udp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/udp.c b/udp.c
index 933f24b..c031a05 100644
--- a/udp.c
+++ b/udp.c
@@ -260,7 +260,8 @@ static void udp_invert_portmap(struct udp_port_fwd *fwd)
{
int i;
- ASSERT(ARRAY_SIZE(fwd->f.delta) == ARRAY_SIZE(fwd->rdelta));
+ static_assert(ARRAY_SIZE(fwd->f.delta) == ARRAY_SIZE(fwd->rdelta),
+ "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];