[glib] GVariantBuilder: small documentation fixes



commit 330905587860ee83a1931ad3b6794cdfde35f582
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Nov 23 13:16:06 2013 -0500

    GVariantBuilder: small documentation fixes
    
    The examples for g_variant_builder_add and
    g_variant_builder_add_parsed were leaking a heap-allocated
    builder. Fix that by converting the examples to stack
    allocation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697585
    https://bugzilla.gnome.org/show_bug.cgi?id=703522

 glib/gvariant-parser.c |   18 +++++++++---------
 glib/gvariant.c        |   16 ++++++++--------
 2 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/glib/gvariant-parser.c b/glib/gvariant-parser.c
index dc655ce..de140d0 100644
--- a/glib/gvariant-parser.c
+++ b/glib/gvariant-parser.c
@@ -2521,23 +2521,23 @@ g_variant_new_parsed (const gchar *format,
  *
  * This function might be used as follows:
  *
- * <programlisting>
+ * |[
  * GVariant *
  * make_pointless_dictionary (void)
  * {
- *   GVariantBuilder *builder;
+ *   GVariantBuilder builder;
  *   int i;
  *
- *   builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
- *   g_variant_builder_add_parsed (builder, "{'width', <%i>}", 600);
- *   g_variant_builder_add_parsed (builder, "{'title', <%s>}", "foo");
- *   g_variant_builder_add_parsed (builder, "{'transparency', <0.5>}");
- *   return g_variant_builder_end (builder);
+ *   g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+ *   g_variant_builder_add_parsed (&builder, "{'width', <%i>}", 600);
+ *   g_variant_builder_add_parsed (&builder, "{'title', <%s>}", "foo");
+ *   g_variant_builder_add_parsed (&builder, "{'transparency', <0.5>}");
+ *   return g_variant_builder_end (&builder);
  * }
- * </programlisting>
+ * ]|
  *
  * Since: 2.26
- **/
+ */
 void
 g_variant_builder_add_parsed (GVariantBuilder *builder,
                               const gchar     *format,
diff --git a/glib/gvariant.c b/glib/gvariant.c
index 3b3f7df..0e02867 100644
--- a/glib/gvariant.c
+++ b/glib/gvariant.c
@@ -4884,7 +4884,7 @@ g_variant_get_va (GVariant     *value,
 /* Varargs-enabled Utility Functions {{{1 */
 
 /**
- * g_variant_builder_add: (skp)
+ * g_variant_builder_add: (skip)
  * @builder: a #GVariantBuilder
  * @format_string: a #GVariant varargs format string
  * @...: arguments, as per @format_string
@@ -4896,28 +4896,28 @@ g_variant_get_va (GVariant     *value,
  *
  * This function might be used as follows:
  *
- * <programlisting>
+ * |[
  * GVariant *
  * make_pointless_dictionary (void)
  * {
- *   GVariantBuilder *builder;
+ *   GVariantBuilder builder;
  *   int i;
  *
- *   builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
+ *   g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
  *   for (i = 0; i < 16; i++)
  *     {
  *       gchar buf[3];
  *
  *       sprintf (buf, "%d", i);
- *       g_variant_builder_add (builder, "{is}", i, buf);
+ *       g_variant_builder_add (&builder, "{is}", i, buf);
  *     }
  *
- *   return g_variant_builder_end (builder);
+ *   return g_variant_builder_end (&builder);
  * }
- * </programlisting>
+ * ]|
  *
  * Since: 2.24
- **/
+ */
 void
 g_variant_builder_add (GVariantBuilder *builder,
                        const gchar     *format_string,


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