summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-09-28 13:10:14 +0200
committerThomas Haller <thaller@redhat.com>2022-10-03 17:57:43 +0200
commitee32de41cfd47f25932f7dc872f977a93375cc73 (patch)
treed48f5dc0f725bff31b0bbbef9f8b002e930664d9
parente7582e7dd35c1b66a1c80cee360c9e1225e98549 (diff)
downloadNetworkManager-ee32de41cfd47f25932f7dc872f977a93375cc73.tar.gz
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?
-rw-r--r--src/libnm-glib-aux/nm-uuid.h3
1 files changed, 3 insertions, 0 deletions
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), \