diff options
author | Berke Viktor <bviktor@hexchat.org> | 2013-05-12 06:16:26 +0200 |
---|---|---|
committer | Berke Viktor <bviktor@hexchat.org> | 2013-05-12 06:16:26 +0200 |
commit | 9327a5c71f8aeb12f61060d3d2543f4cee001c40 (patch) | |
tree | 7534a0e0fb4c0a76465867cd857521f96fdadd50 /src/common | |
parent | 171dbcdedf0712c3822bf619ea2fc4f329c0aef3 (diff) |
Reduce GLib requirement
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/servlist.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/common/servlist.c b/src/common/servlist.c index 7c1789a9..83815c9f 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -581,6 +581,41 @@ static const struct defaultserver def[] = GSList *network_list = 0; +#if !GLIB_CHECK_VERSION(2,34,0) +#define g_slist_copy_deep servlist_slist_copy_deep +/* FIXME copy-paste from gslist.c, should be dumped sometime */ +static GSList* +servlist_slist_copy_deep (GSList *list, GCopyFunc func, gpointer user_data) +{ + GSList *new_list = NULL; + + if (list) + { + GSList *last; + + new_list = g_slice_new (GSList); + if (func) + new_list->data = func (list->data, user_data); + else + new_list->data = list->data; + last = new_list; + list = list->next; + while (list) + { + last->next = g_slice_new (GSList); + last = last->next; + if (func) + last->data = func (list->data, user_data); + else + last->data = list->data; + list = list->next; + } + last->next = NULL; + } + + return new_list; +} +#endif void servlist_connect (session *sess, ircnet *net, gboolean join) |