From c703c0cece28259d2066f75c4cfae07318ef499b Mon Sep 17 00:00:00 2001 From: Jochen De Smet Date: Tue, 14 Jun 2011 01:40:01 -0400 Subject: [PATCH] Move slist_insert_unique_sorted to sipe-utils --- src/core/sipe-utils.c | 13 +++++++++++++ src/core/sipe-utils.h | 13 +++++++++++++ src/core/sipe.c | 12 ------------ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/core/sipe-utils.c b/src/core/sipe-utils.c index 534beaeb..42261e50 100644 --- a/src/core/sipe-utils.c +++ b/src/core/sipe-utils.c @@ -533,6 +533,19 @@ sipe_utils_is_avconf_uri(const gchar *uri) return g_strstr_len(uri, -1, "app:conf:audio-video:") != NULL; } +/** + * Only appends if no such value already stored. + * Like Set in Java. + */ +GSList * +slist_insert_unique_sorted(GSList *list, gpointer data, GCompareFunc func) { + GSList * res = list; + if (!g_slist_find_custom(list, data, func)) { + res = g_slist_insert_sorted(list, data, func); + } + return res; +} + /* Local Variables: mode: c diff --git a/src/core/sipe-utils.h b/src/core/sipe-utils.h index d5edf4f3..e790b842 100644 --- a/src/core/sipe-utils.h +++ b/src/core/sipe-utils.h @@ -451,3 +451,16 @@ gchar *sipe_utils_uri_unescape(const gchar *string); * @return @c TRUE if the string represents AV conference URI */ gboolean sipe_utils_is_avconf_uri(const gchar *uri); + +/** + * Inserts in item in the list only if the value isn't already in that list + * + * @param list a singly linked list + * @param data the item to insert + * @param fund function to use to compare the values + * + * @return the new list head + */ +GSList * +slist_insert_unique_sorted(GSList *list, gpointer data, GCompareFunc func); + diff --git a/src/core/sipe.c b/src/core/sipe.c index 783754d4..7ef4917d 100644 --- a/src/core/sipe.c +++ b/src/core/sipe.c @@ -332,18 +332,6 @@ sipe_process_presence_wpending (struct sipe_core_private *sipe_private, } /** - * Only appends if no such value already stored. - * Like Set in Java. - */ -GSList * slist_insert_unique_sorted(GSList *list, gpointer data, GCompareFunc func) { - GSList * res = list; - if (!g_slist_find_custom(list, data, func)) { - res = g_slist_insert_sorted(list, data, func); - } - return res; -} - -/** * Returns string like "2 4 7 8" - group ids buddy belong to. */ static gchar * -- 2.11.4.GIT