GNOME Bugzilla – Bug 756099
g_main_context_query(): Annotate @n_fds as (in) parameter
Last modified: 2015-10-15 21:11:05 UTC
The default is picked up as (out), which is bogus.
Created attachment 312698 [details] [review] g_main_context_query(): Annotate @n_fds as (in) parameter
Review of attachment 312698 [details] [review]: ::: glib/gmain.c @@ +3520,3 @@ * @fds: (out caller-allocates) (array length=n_fds): location to * store #GPollFD records that need to be polled. + * @n_fds: (in): length of @fds. Ugh, this API is awful. It's getgrouplist(), only dumber. Yes, technically speaking this is an in argument. In practice, though, we'd need a different function that used a callee-allocated array and returned the size of it. Anyway, this is okay.
To be fair, I'm not even sure how language bindings are supposed to wrap this function correctly.
(In reply to Emmanuele Bassi (:ebassi) from comment #3) > To be fair, I'm not even sure how language bindings are supposed to wrap > this function correctly. The array is caller-allocated, so it should be doable. But I'm mostly beating around odd C type annotations to make sure low-level Rust bindings can be generated correctly with less manual labour. One flavour of oddity is when C types for (out) parameters don't look like pointers.
Attachment 312698 [details] pushed as 75eaf50 - g_main_context_query(): Annotate @n_fds as (in) parameter