summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2006-10-12 07:51:37 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2006-10-12 07:51:37 +0000
commit351ec5438c38eb319ff861f1498fa0dacb747e60 (patch)
tree3ad4b37f9de681080be57b63c3566afd40634900 /common
parent3ec96c0b0cd8d78ebede255583a918145a0eeaa0 (diff)
Use slist_insert_sorted for maintaining watch list
Diffstat (limited to 'common')
-rw-r--r--common/glib-ectomy.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/common/glib-ectomy.c b/common/glib-ectomy.c
index f3478edf..46d92154 100644
--- a/common/glib-ectomy.c
+++ b/common/glib-ectomy.c
@@ -205,20 +205,13 @@ void g_io_remove_watch(guint id)
}
}
-static struct slist *watch_list_add(struct slist *l, struct watch *watch)
+int watch_prio_cmp(struct watch *w1, struct watch *w2)
{
- struct slist *cur;
-
- for (cur = l; cur != NULL; cur = cur->next) {
- struct watch *w = cur->data;
-
- if (w->priority >= watch->priority)
- break;
- }
-
- return slist_insert_before(l, cur, watch);
+ return w1->priority - w2->priority;
}
+#define watch_list_add(l, w) slist_insert_sorted((l), (w), (cmp_func_t) watch_prio_cmp)
+
guint g_io_add_watch_full(GIOChannel *channel, gint priority,
GIOCondition condition, GIOFunc func,
gpointer user_data, GDestroyNotify notify)