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 754137 - List.search wrong binding
List.search wrong binding
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings: GLib
0.29.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-26 19:01 UTC by Michele Dionisio
Modified: 2016-09-14 13:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix search methods (1.88 KB, patch)
2015-10-13 00:13 UTC, Ben
rejected Details | Review
Amend original patch so it now applies because [Version (since = "2.4")] is now present in Queue (1.86 KB, patch)
2016-09-11 11:09 UTC, Al Thomas
committed Details | Review

Description Michele Dionisio 2015-08-26 19:01:52 UTC
I think that the following function:

[CCode (cname = "g_list_find_custom", simple_generics = true)]
public unowned List<G> search<T> (T data, SearchFunc<T,G> func);

in glib vapi is wrong because the g_list_find_custom documentation says?

Finds an element in a GList, using a supplied function to find the desired element. It iterates over the list, calling the given function which should return 0 when the desired element is found. The function takes two gconstpointer arguments, the GList element's data as the first argument and the given user data.

so the function has to be:
[CCode (cname = "g_list_find_custom", simple_generics = true)]
public unowned List<G> search<T> (T data, SearchFunc<G,T> func);
Comment 1 Ben 2015-10-13 00:13:29 UTC
Created attachment 313158 [details] [review]
fix search methods
Comment 2 Al Thomas 2016-09-11 11:09:51 UTC
Created attachment 335298 [details] [review]
Amend original patch so it now applies because [Version (since = "2.4")] is now present in Queue

The original patch looks fine and matches the documentation:
https://developer.gnome.org/glib/stable/glib-Doubly-Linked-Lists.html#g-list-find-custom
https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html#g-slist-find-custom
https://developer.gnome.org/glib/stable/glib-Double-ended-Queues.html#g-queue-find-custom
The first type argument to SearchFunc should be the collection element's data type.

The original patch no longer applies because Version attribute is present now. This new patch just amends that so it applies.
Comment 3 Al Thomas 2016-09-11 11:10:56 UTC
Review of attachment 313158 [details] [review]:

Patch looks good, but no longer applies. Amended patch attached separately.
Comment 4 Al Thomas 2016-09-11 11:10:57 UTC
Review of attachment 313158 [details] [review]:

Patch looks good, but no longer applies. Amended patch attached separately.