pidgin: 5c713a32: g_hash_table_get_keys is GLIB>2.14.0 but...

markdoliner at pidgin.im markdoliner at pidgin.im
Tue Nov 9 20:20:22 EST 2010


----------------------------------------------------------------------
Revision: 5c713a32d5129f0f61f601808088dde29bdaa9ca
Parent:   ad151922d1c3745be314ea937d77aa8bcab04379
Author:   markdoliner at pidgin.im
Date:     11/09/10 20:17:22
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5c713a32d5129f0f61f601808088dde29bdaa9ca

Changelog: 

g_hash_table_get_keys is GLIB>2.14.0 but we maintain compatibility with 2.12.0.
So implement a workaround.

media.c also uses g_hash_table_get_keys, but I didn't change that one.

Changes against parent ad151922d1c3745be314ea937d77aa8bcab04379

  patched  libpurple/protocols/oscar/oscar.c

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	ea3d3962582dd7fb3715e76a29d159bc59dbedd3
+++ libpurple/protocols/oscar/oscar.c	c3403bd5aac2a5b848608de84b0350b52047c706
@@ -637,6 +637,15 @@ compare_handlers(gconstpointer a, gconst
 	return subtype1 - subtype2;
 }
 
+#if !GLIB_CHECK_VERSION(2,14,0)
+static void hash_table_get_list_of_keys(gpointer key, gpointer value, gpointer user_data)
+{
+	GList **handlers = (GList **)user_data;
+
+	*handlers = g_list_prepend(*handlers, key);
+}
+#endif /* GLIB < 2.12.0 */
+
 void
 oscar_login(PurpleAccount *account)
 {
@@ -706,7 +715,12 @@ oscar_login(PurpleAccount *account)
 	oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, 0x0003, purple_parse_searchreply, 0);
 
 	g_string_append(msg, "Registered handlers: ");
+#if GLIB_CHECK_VERSION(2,14,0)
 	handlers = g_hash_table_get_keys(od->handlerlist);
+#else
+	handlers = NULL;
+	g_hash_table_foreach(od->handlerlist, hash_table_get_list_of_keys, &handlers);
+#endif /* GLIB < 2.12.0 */
 	sorted_handlers = g_list_sort(g_list_copy(handlers), compare_handlers);
 	for (cur = sorted_handlers; cur; cur = cur->next) {
 		guint x = GPOINTER_TO_UINT(cur->data);


More information about the Commits mailing list