From ee32de41cfd47f25932f7dc872f977a93375cc73 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 28 Sep 2022 13:10:14 +0200 Subject: [PATCH] glib-aux: add code comment to NM_UUID_INIT() `NM_UUID_INIT(00, 09, 01, ...)` would look as if the values are octal numbers. That is not the case. The macro mangles them, so that the look like the UUID in string form "000901...". This is a bit odd. Maybe more confusing than helpful. Or maybe helpful? --- src/libnm-glib-aux/nm-uuid.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libnm-glib-aux/nm-uuid.h b/src/libnm-glib-aux/nm-uuid.h index 15b03a2d47..f84778998e 100644 --- a/src/libnm-glib-aux/nm-uuid.h +++ b/src/libnm-glib-aux/nm-uuid.h @@ -9,6 +9,9 @@ typedef struct _NMUuid { #define NM_UUID_INIT_ZERO() ((NMUuid){.uuid = {0}}) +/* Beware, the 16 macro arguments are two hex-digits, not plain numbers. The macro + * will automatically add the "0x". In particular, "09" is not an octal number, it's + * 0x09. This oddity is so that the arguments look very much like the UUID in string form. */ #define NM_UUID_INIT(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) \ ((NMUuid){ \ .uuid = {(0x##a0), \