After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 622294 - More annotations for GVariant
More annotations for GVariant
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gvariant
unspecified
Other All
: Normal normal
: ---
Assigned To: Allison Karlitskaya (desrt)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-06-21 15:16 UTC by Milan Bouchet-Valat
Modified: 2010-06-29 17:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
More annotations for GVariant (8.54 KB, patch)
2010-06-21 15:16 UTC, Milan Bouchet-Valat
none Details | Review

Description Milan Bouchet-Valat 2010-06-21 15:16:32 UTC
I've gone over all functions and added 'allow-none', 'array length', 'out' and 'default' annotations where needed. I can't guarantee I've not missed a few things, though.

The 'default' annotation is not yet used, but it's still good to have. I've put '(default NULL)' where optional parameters are used e.g. to limit the size of a string which is expected to be NULL-terminated if the param is omitted. For size parameters, I've not added it since bindings know what it's used to, and can decide to skip it if they want.

I'm not familiar with how bindings work, so I may have done silly things!
Comment 1 Milan Bouchet-Valat 2010-06-21 15:16:37 UTC
Created attachment 164224 [details] [review]
More annotations for GVariant

This adds annotations to all functions in gvariant.c. A few docs
were also fixed (wrong parameter names, missing mention that NULL
is allowed).
Comment 2 Matthias Clasen 2010-06-21 15:36:44 UTC
Looks good to me.
Comment 3 Christian Persch 2010-06-21 16:00:22 UTC
 /**
  * g_variant_print_string:
  * @value: a #GVariant
- * @string: a #GString, or %NULL
+ * @string: (out) (allow-none) (default NULL): a #GString, or %NULL

That doesn't seem correct. @string is an (in) param, not (out). This function however does return @string if it was non-NULL, and otherwise a _new_ #GString. I don't think a construct like that can currently be expressed as an annotation on Return: ... ?
Comment 4 Milan Bouchet-Valat 2010-06-21 16:03:19 UTC
Indeed, yes. Anyway I don't think it can be fully used by bindings without manual tweaking. So just removing the (out) should be enough - it's hard to explain that if @string wasn't NULL, then the return value shouldn't be freed (twice).
Comment 5 Colin Walters 2010-06-21 16:09:28 UTC
My perspective is that GVariant should be bound manually.  

This doesn't mean that the annotations shouldn't be added - I find them useful also for C authors instead of the extremely verbose boilerplate English equivalents of e.g. (transfer full).
Comment 6 Milan Bouchet-Valat 2010-06-29 17:39:03 UTC
Pushed with a fix to the print_string() @string param, and a missing (default NULL) annotation for the get_string() @string param. Commit ab6b6c6.