Re: [Vala] ArrayList sort function



I cleaned up the comparison functions a bit after playing with Vala
pointers and begging on IRC.

best
Dan
___________________________
Daniel Lucraft
http://www.daniellucraft.com/



2008/11/21 Daniel Lucraft <dan fluentradical com>:
As requested on IRC, here are two patches that add a sort method to ArrayList.

Some notes:
 1. I wasn't sure where to put the vapi binding to the C stdlib
function qsort. But I saw that
   glib.vapi had the reference to the strcmp function so I put it next to that.
 2. There are two comparison functions - intcmp and strcmp - that can
be used with the qsort function.
   Again I wasn't sure where to put them so I put them in ArrayList
next to where they would be used.
 3. I hope it is possible to have nicer comparison functions that
don't have two levels of
   indirection for objects (see the test), but I just couldn't make
them work. (I tried hard!)

thanks
Dan

___________________________
Daniel Lucraft
http://www.daniellucraft.com/

Attachment: 0001-Added-sort-method-to-ArrayList.patch
Description: Text Data

Attachment: 0001-Added-c-stdlib-qsort-to-glib.patch
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]