Re: g_list_sort2



Jonathan Blandford <jrb redhat com> writes:

> There is a g_list_sort2 function in glist.c.  It doesn't seem to be used
> anywhere, and indeed, isn't even in the header files.  Does anyone know
> where it came from, or object if I remove it?

If you're touching glist.c anyway, could you consider applying the
patch below?  It's about making g_list_sort stable, that is, so that
it keeps the relative order of elements in the list that compare equal
with respect to the compare func.  I believe Tim gave a green light
for this patch some time ago (see http://mail.gnome.org/archives/gtk-devel-list/2000-September/msg00314.html) 
but so far nothing has happened, and I dont have CVS write access
myself.

regards, Kristian


cvs server: Diffing .
Index: glist.c
===================================================================
RCS file: /cvs/gnome/glib/glist.c,v
retrieving revision 1.17
diff -u -r1.17 glist.c
--- glist.c	2000/07/26 11:01:59	1.17
+++ glist.c	2000/11/13 21:29:26
@@ -607,7 +607,7 @@
 
   while (l1 && l2)
     {
-      if (compare_func (l1->data, l2->data) < 0)
+      if (compare_func (l1->data, l2->data) <= 0)
         {
 	  l->next = l1;
 	  l = l->next;
Index: gslist.c
===================================================================
RCS file: /cvs/gnome/glib/gslist.c,v
retrieving revision 1.17
diff -u -r1.17 gslist.c
--- gslist.c	2000/07/26 11:01:59	1.17
+++ gslist.c	2000/11/13 21:29:26
@@ -591,7 +591,7 @@
 
   while (l1 && l2)
     {
-      if (compare_func(l1->data,l2->data) < 0)
+      if (compare_func(l1->data,l2->data) <= 0)
         {
 	  l=l->next=l1;
 	  l1=l1->next;




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