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 584453 - Default annotations value for const gchar* const *
Default annotations value for const gchar* const *
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2009-06-01 13:53 UTC by David Zeuthen (not reading bugmail)
Modified: 2015-02-07 17:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a test_strv_out which is unannotated, rename current to test_strv_out_container (2.15 KB, patch)
2009-06-04 19:05 UTC, Colin Walters
accepted-commit_now Details | Review
Bug 584453 - Handle char ** correctly (and const variation) (9.89 KB, patch)
2009-06-04 19:05 UTC, Colin Walters
accepted-commit_now Details | Review

Description David Zeuthen (not reading bugmail) 2009-06-01 13:53:40 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>
Comment 1 David Zeuthen (not reading bugmail) 2009-06-01 17:10:27 UTC
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...
Comment 2 David Zeuthen (not reading bugmail) 2009-06-02 00:39:28 UTC
See bug 584568 comment 1 for an illustration of the problem.
Comment 3 Colin Walters 2009-06-04 19:05:07 UTC
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.
Comment 4 Colin Walters 2009-06-04 19:05:10 UTC
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 5 Johan (not receiving bugmail) Dahlin 2009-06-04 22:03:16 UTC
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
Comment 6 Colin Walters 2009-06-09 17:58:41 UTC
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
Comment 7 André Klapper 2015-02-07 17:02:54 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]