mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 08:28:53 +02:00
- Call g_queue_insert_sorted() instead of duplicating the code. - Call
* glib/gasyncqueue.c: - Call g_queue_insert_sorted() instead of duplicating the code. - Call g_queue_sort() instead of duplicating the code. - Invert sort function results to make sure the same sort function gives the same results across glist, gslist, gqueue and gasyncqueue. * tests/asyncqueue-test.c: - Updated the sort function to reflect the example in the documentation for gasyncqueue.c.
This commit is contained in:
@@ -37,16 +37,16 @@ static GAsyncQueue *async_queue = NULL;
|
||||
static gint
|
||||
sort_compare (gconstpointer p1, gconstpointer p2, gpointer user_data)
|
||||
{
|
||||
gint id1;
|
||||
gint id2;
|
||||
gint32 id1;
|
||||
gint32 id2;
|
||||
|
||||
id1 = GPOINTER_TO_INT (p1);
|
||||
id2 = GPOINTER_TO_INT (p2);
|
||||
|
||||
d(g_print ("comparing #1:%d and #2:%d, returning %d\n",
|
||||
id1, id2, (id2 - id1)));
|
||||
id1, id2, (id1 > id2 ? +1 : id1 == id2 ? 0 : -1)));
|
||||
|
||||
return (id2 - id1);
|
||||
return (id1 > id2 ? +1 : id1 == id2 ? 0 : -1);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
Reference in New Issue
Block a user