Transfer rules of inout parameters
- From: philip chimento gmail com
- To: "gir-devel-list gnome org" <gir-devel-list gnome org>
- Subject: Transfer rules of inout parameters
- Date: Fri, 09 Feb 2018 07:49:52 +0000
Next up! (I think this is the last of my Bugzilla-migration-triggered mail series.)
Transfer rules of inout parameters:
tl;dr: some time ago a commit to gobject-introspection broke a test in GJS and I've never been able to figure out whether gobject-introspection or GJS is wrong.
I always thought inout worked like this: a function with an inout parameter
/* inout: (transfer full): */
void func(char **inout) {
g_assert (strcmp (*inout, utf8_const) == 0);
g_free (*inout);
*inout = g_strdup (utf8_nonconst);
}
should have exactly the same transfer rules as a function with two separate parameters
/* in: (transfer full):
* out: (transfer full): */
void func2(char *in, char **out) {
g_assert (strcmp (in, utf8_const) == 0);
g_free (in);
*out = g_strdup (utf8_nonconst);
}
That, at least I think, is how gobject-introspection specifies it (de facto, by virtue of the code working like that.) GJS interprets it as
in: (transfer none)
out: (transfer full)
and Giovanni commented on that bug, that he thought existing libraries required that interpretation.
The test in GJS has been commented out for 2 years waiting for me to figure this out. Does anyone know?
Regards,
Philip C
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]