From dc5ac4d83c3e4e0cc2f7e87936178969fc624266 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 8 Mar 2023 14:35:04 +0100 Subject: [PATCH] std-aux/trivial: add code comment to NM_IS_IPv4() --- src/libnm-std-aux/nm-std-aux.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libnm-std-aux/nm-std-aux.h b/src/libnm-std-aux/nm-std-aux.h index a5e5abd3d5..a146487eff 100644 --- a/src/libnm-std-aux/nm-std-aux.h +++ b/src/libnm-std-aux/nm-std-aux.h @@ -1419,6 +1419,9 @@ nm_utils_addr_family_to_char(int addr_family) (NM_UNIQ_T(_addr_family, uniq) == NM_AF_INET); \ }) +/* NM_IS_IPv4() is guaranteed to give either 0 or 1! That is an important + * guarantee, because we often use that value to index a 2-array (where at + * position zero is IPv6 and at position 1 IPv4). */ #define NM_IS_IPv4(addr_family) _NM_IS_IPv4(NM_UNIQ, addr_family) static inline int