[glib] gvariant-parser: Clarify g_variant_parse() returns a non-floating ref



commit 1b3dbec0658695deee02b35b7d9a3fce981ce772
Author: Philip Withnall <philip tecnocode co uk>
Date:   Tue Apr 21 23:56:10 2015 +0100

    gvariant-parser: Clarify g_variant_parse() returns a non-floating ref
    
    Unlike, say, g_variant_new(), which returns a floating reference.
    g_variant_parse() returns a non-floating one, so must always have
    g_variant_unref() called on the result.

 glib/gvariant-parser.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/glib/gvariant-parser.c b/glib/gvariant-parser.c
index 3a8c63d..e7dab85 100644
--- a/glib/gvariant-parser.c
+++ b/glib/gvariant-parser.c
@@ -2346,7 +2346,8 @@ parse (TokenStream  *stream,
  * with empty arrays).
  *
  * In the event that the parsing is successful, the resulting #GVariant
- * is returned.
+ * is returned. It is never floating, and must be freed with
+ * g_variant_unref().
  *
  * In case of any error, %NULL will be returned.  If @error is non-%NULL
  * then it will be set to reflect the error that occurred.
@@ -2354,7 +2355,7 @@ parse (TokenStream  *stream,
  * Officially, the language understood by the parser is "any string
  * produced by g_variant_print()".
  *
- * Returns: a reference to a #GVariant, or %NULL
+ * Returns: a non-floating reference to a #GVariant, or %NULL
  **/
 GVariant *
 g_variant_parse (const GVariantType  *type,


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