Re: [PHP4BETA] Sorting zend's double linked list

From: Date: Fri, 18 Feb 2000 14:47:39 +0000
Subject: Re: [PHP4BETA] Sorting zend's double linked list
Groups: php.version4 
Request: Send a blank email to php-version4+get-10455@lists.php.net to get a copy of this message
Uwe, As I'm sure you want this function pretty quickly (and I was just about to go to sleep) I implemented something very quickly which we can optimize some other time. It is untested so it might crash :) No seriously, these kind of functions tend to get messy and I don't have time to test it now so first try and use it and then we'll debug if there are problems. The function is: void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func); You call zend_llist_sort() with a pointer to your list and a pointer to your compare function which is of type: int (*comp_func) (const llist_element *le1, const llist_element *le2) That means you return an integer value >, <, = to zero like usually compare functions do, and you are passed two llist_elements where your data is held. What you want to compare is the data itself meaning le1->data and le2->data which are pointers to the data you saved. Don't, modify the data itself while comparing. Let me know of problems, crashes, etc.... Andi At 01:17 PM 2/18/00 +0100, Uwe Steinmann wrote:
Hi, Andi has changed the wddx module to use zend's double linked list. I would like to do the same for the hyperwave module which seems to be the only one still using dlist.c. Just a small Problem: The zend list doesn't contain a sort function which I would need. Is there anybody who's got more knowledge on sort algorithmens then me, and also has some time to implement it? Uwe -- Uwe.Steinmann@fernuni-hagen.de
  Tel: +2331 987 4528    Fax: +2331 987 375
-- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net For additional commands, e-mail: php4beta-help@lists.php.net To contact the list administrators, e-mail: php4beta-admin@lists.php.net
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.version4 (#10455) next »