GNOME Bugzilla – Bug 584453
Default annotations value for const gchar* const *
Last modified: 2015-02-07 17:02:54 UTC
It would be useful if we defaulted to (transfer none) (array zero-terminated=1) (element-type utf8) when the user is using this C type const gchar* const * For example, we seem to get this wrong for e.g. g_get_system_data_dirs() <function name="get_system_data_dirs" c:identifier="g_get_system_data_dirs"> <return-value transfer-ownership="full"> <type name="utf8" c:type="gchar**"/> </return-value> </function> and also g_themed_icon_get_names() <method name="get_names" c:identifier="g_themed_icon_get_names"> <return-value transfer-ownership="full"> <type name="utf8" c:type="char**"/> </return-value> </method>
Hmm, seems we even get it wrong for gchar** <function name="strsplit" c:identifier="g_strsplit"> <return-value transfer-ownership="full"> <type name="utf8" c:type="gchar**"/> </return-value> Shouldn't this default to: (transfer full) (array zero-terminated=1) (element-type utf8) Puzzled...
See bug 584568 comment 1 for an illustration of the problem.
Created attachment 135971 [details] [review] Add a test_strv_out which is unannotated, rename current to test_strv_out_container We need a test case for a plain unannotated char ** return value, which should be an array. Keep the old annotated test as a test case for the container transfer.
Created attachment 135972 [details] [review] Bug 584453 - Handle char ** correctly (and const variation) This patch fixes our default handling of char **. We add Return node types as a case where we test for array handling. Remove the hardcoded assumption of array = "no transfer", just use the separate Parameter/Return cases. This change causes inout char ** to be transfer="full", but that seems more correct.
Comment on attachment 135972 [details] [review] Bug 584453 - Handle char ** correctly (and const variation) Assumnig you have carefully reviewed the unexpected gir changes for correctness
Finally getting a chance to test and followup on this, there are actually no changes in gir-repository, so good to go with this one. Thanks for review. Commit b23ca1ec2afeed3c5ab914c996c1dd73870ecab6 Author: Colin Walters <walters@verbum.org> Date: Thu Jun 4 13:51:26 2009 -0400 Bug 584453 - Handle char ** correctly (and const variation) commit 4a5c6543195963d9a09843d9b015dd9db3107798 Author: Colin Walters <walters@verbum.org> Date: Thu Jun 4 12:40:41 2009 -0400 Add a test_strv_out which is unannotated, rename current to test_strv_out_container
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]