[glib: 1/2] Explain magic literals in G_VARIANT_*_INIT




commit bc2ca9df20818621309595a67101c504c1d10e6c
Author: Alexander Klauer <alexander klauer googlemail com>
Date:   Fri Mar 4 11:29:58 2022 +0000

    Explain magic literals in G_VARIANT_*_INIT

 glib/gvariant.h | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/glib/gvariant.h b/glib/gvariant.h
index 11c74d596..7ba586c61 100644
--- a/glib/gvariant.h
+++ b/glib/gvariant.h
@@ -362,7 +362,14 @@ GQuark                          g_variant_parse_error_quark             (void);
  *
  * Since: 2.50
  */
-#define G_VARIANT_BUILDER_INIT(variant_type) { { { 2942751021u, variant_type, { 0, } } } }
+#define G_VARIANT_BUILDER_INIT(variant_type)                                          \
+  {                                                                                   \
+    {                                                                                 \
+      {                                                                               \
+        2942751021u /* == GVSB_MAGIC_PARTIAL, see gvariant.c */, variant_type, { 0, } \
+      }                                                                               \
+    }                                                                                 \
+  }
 
 GLIB_AVAILABLE_IN_ALL
 GVariantBuilder *               g_variant_builder_new                   (const GVariantType   *type);
@@ -478,7 +485,14 @@ struct _GVariantDict {
  *
  * Since: 2.50
  */
-#define G_VARIANT_DICT_INIT(asv) { { { asv, 3488698669u, { 0, } } } }
+#define G_VARIANT_DICT_INIT(asv)                                             \
+  {                                                                          \
+    {                                                                        \
+      {                                                                      \
+        asv, 3488698669u /* == GVSD_MAGIC_PARTIAL, see gvariant.c */, { 0, } \
+      }                                                                      \
+    }                                                                        \
+  }
 
 GLIB_AVAILABLE_IN_2_40
 GVariantDict *                  g_variant_dict_new                      (GVariant             *from_asv);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]