Ignoring a Function's Return Value
I am trying to annotate this function for introspection:
GnmRange *
range_init (GnmRange *r, int start_col, int start_row,
int end_col, int end_row)
{
// Irrelevant code removed
return r;
}
This would be a boring function were it not for the return value, a copy of its first argument. That cannot be expressed with annotations, I believe, so ignoring the return value is the next best thing.
This annotation used to work (with versions used in Linux Mint 19), but now produces crashes when used from python. The documentation, as I read it, suggests that this is the correct way to do things. I cannot find examples that use return value skipping other than for gboolean for which memory management does not come into play.
/**
* range_init:
* @r: A #GnmRange to change
...
*
* Updates @r to start at (@start_col,@start_row) and end
* at (@end_col,@end_row).
*
* Returns: (skip) (transfer none): @r
*/
Now I seem to have to do this (g-ir-scanner 1.64.1):
/**
* range_init:
* @r: A #GnmRange to change
...
*
* Updates @r to start at (@start_col,@start_row) and end
* at (@end_col,@end_row).
*
* Returns: (type void): @r
*/
Overriding the parser's type is a big hack.
The function is a bit like, say, g_string_assign which has an annotation of simply (transfer none). I could emulate that, but it doesn't seem right to be. It looks like a separate object is seen on the python side.