diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-02-20 13:48:23 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-02-20 08:14:08 +0100 |
commit | 8954c4a91b98b734797c3d1292d6635d917fa4d8 (patch) | |
tree | 4f3d52141dc632d9d0e1e594e61f26b145fde6c8 | |
parent | ff22a78d7b5235403163969cfa294dfb2293c4c6 (diff) | |
download | passt-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.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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]; |