Remove unused function g_list_sort2 (bug #113203).

2003-05-19  Noah Levitt  <nlevitt@columbia.edu>

	* glib/glist.c: Remove unused function g_list_sort2 (bug #113203).
This commit is contained in:
Noah Levitt 2003-05-19 17:02:32 +00:00 committed by Noah Levitt
parent 6bc2ee510a
commit 6c4580c9c7
7 changed files with 24 additions and 59 deletions

View File

@ -1,3 +1,7 @@
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/glist.c: Remove unused function g_list_sort2 (bug #113203).
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/gunidecomp.c: Fix off-by-one error in

View File

@ -1,3 +1,7 @@
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/glist.c: Remove unused function g_list_sort2 (bug #113203).
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/gunidecomp.c: Fix off-by-one error in

View File

@ -1,3 +1,7 @@
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/glist.c: Remove unused function g_list_sort2 (bug #113203).
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/gunidecomp.c: Fix off-by-one error in

View File

@ -1,3 +1,7 @@
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/glist.c: Remove unused function g_list_sort2 (bug #113203).
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/gunidecomp.c: Fix off-by-one error in

View File

@ -1,3 +1,7 @@
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/glist.c: Remove unused function g_list_sort2 (bug #113203).
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/gunidecomp.c: Fix off-by-one error in

View File

@ -1,3 +1,7 @@
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/glist.c: Remove unused function g_list_sort2 (bug #113203).
2003-05-19 Noah Levitt <nlevitt@columbia.edu>
* glib/gunidecomp.c: Fix off-by-one error in

View File

@ -813,62 +813,3 @@ g_list_sort_with_data (GList *list,
return g_list_sort_real (list, (GFunc) compare_func, TRUE, user_data);
}
static GList*
g_list_sort2 (GList *list,
GCompareFunc compare_func)
{
GSList *runs = NULL;
GList *tmp;
/* Degenerate case. */
if (!list) return NULL;
/* Assume: list = [12,2,4,11,2,4,6,1,1,12]. */
for (tmp = list; tmp; )
{
GList *tmp2;
for (tmp2 = tmp;
tmp2->next && compare_func (tmp2->data, tmp2->next->data) <= 0;
tmp2 = tmp2->next)
/* Nothing */;
runs = g_slist_append (runs, tmp);
tmp = tmp2->next;
tmp2->next = NULL;
}
/* Now: runs = [[12],[2,4,11],[2,4,6],[1,1,12]]. */
while (runs->next)
{
/* We have more than one run. Merge pairwise. */
GSList *dst, *src, *dstprev = NULL;
dst = src = runs;
while (src && src->next)
{
dst->data = g_list_sort_merge (src->data,
src->next->data,
(GFunc) compare_func,
FALSE, NULL);
dstprev = dst;
dst = dst->next;
src = src->next->next;
}
/* If number of runs was odd, just keep the last. */
if (src)
{
dst->data = src->data;
dstprev = dst;
dst = dst->next;
}
dstprev->next = NULL;
g_slist_free (dst);
}
/* After 1st loop: runs = [[2,4,11,12],[1,1,2,4,6,12]]. */
/* After 2nd loop: runs = [[1,1,2,2,4,4,6,11,12,12]]. */
list = runs->data;
g_slist_free (runs);
return list;
}