Re: [PATCH] Add example for howto use the sort function.
Alexander Malysh <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
committed to cvs. Thanks!
Thanks,
Alex
Wilfried Goesgens schrieb:
> On Wed, Apr 19, 2006 at 12:40:33PM +0200, Alexander Malysh wrote:
>> Hmm, and again something wrong...
>>
> like that?
>
>
> Wilfried G�sgens
>
>
>
> ------------------------------------------------------------------------
>
> --- a/gateway/gwlib/list.h 2005-02-11 16:35:48.000000000 +0100
> +++ b/gateway/gwlib/list.h 2006-04-04 16:22:40.000000000 +0200
> @@ -293,6 +305,16 @@
>
> /*
> * Sort the list with qsort.
> + * if you have a list that you feed like that:
> + * Msg *message;
> + * gwlist_add(mylist, message);
> + * a function that could sort messages by their data length would look like that:
> + * int sort_by_messagelength(void* first_msg_pp, void* second_msg_pp)
> + *{
> + * Msg *first_msg=*(Msg**)first_msg_pp;
> + * Msg *second_msg=*(Msg**)second_msg_pp;
> + * return octstr_len(first_msg->sms.msgdata) - octstr_len(second_msg->sms.msgdata);
> + *}
> */
> void gwlist_sort(List *list, int(*cmp)(const void *, const void *));
>