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 686338 - qsort_with_data have incorrect bindings
qsort_with_data have incorrect bindings
Status: RESOLVED DUPLICATE of bug 640786
Product: vala
Classification: Core
Component: Bindings: GLib
0.18.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2012-10-17 22:44 UTC by Maciej (Matthew) Piechotka
Modified: 2014-01-29 20:17 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Maciej (Matthew) Piechotka 2012-10-17 22:44:15 UTC
Instead of:

private static void qsort_with_data<T> (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc<T> compare_func);

It should be:

private static void qsort_with_data<T> (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc<T *> compare_func);

Currently to sort array of strings (as an example) one need to do:

qsort_with_data<string> (sorted_data, sizeof(string), (a, b) => {return strcmp(*(string **)a, *(string **)b);});
Comment 1 Evan Nemerson 2013-02-19 07:05:16 UTC
Didn't you have a patch for this which used a wrapper like we do for GenericArray?

I hate the idea of making people write wrapper functions instead of just using functions like strcmp directly if we can avoid it.
Comment 2 Maciej (Matthew) Piechotka 2014-01-29 20:17:18 UTC

*** This bug has been marked as a duplicate of bug 640786 ***