adium: 20eb54f1: Use g_hash_table_destroy instead of ..._...

zacw at adiumx.com zacw at adiumx.com
Tue Apr 14 02:08:13 EDT 2009


-----------------------------------------------------------------
Revision: 20eb54f179628d0eb03d21edf024d7748d1964d8
Ancestor: 1e35623360b0e8ccb5b6f537879a7eaa5a2a4cbe
Author: zacw at adiumx.com
Date: 2009-04-14T06:01:35
Branch: im.pidgin.adium
URL: http://d.pidgin.im/viewmtn/revision/info/20eb54f179628d0eb03d21edf024d7748d1964d8

Modified files:
        libpurple/conversation.c

ChangeLog: 

Use g_hash_table_destroy instead of ..._unref. Generate the GList* separately instead of using ..._get_keys.

-------------- next part --------------
============================================================
--- libpurple/conversation.c	d41262e5e5e3de86413c65e5f4cc399731d0ecef
+++ libpurple/conversation.c	7427c0a63d7da2c076f80426775025763f506533
@@ -2057,7 +2057,7 @@ purple_conv_chat_cb_destroy(PurpleConvCh
 	g_free(cb->alias);
 	g_free(cb->alias_key);
 	g_free(cb->name);
-	g_hash_table_unref(cb->attributes);
+	g_hash_table_destroy(cb->attributes);
 
 	PURPLE_DBUS_UNREGISTER_POINTER(cb);
 	g_free(cb);
@@ -2079,12 +2079,23 @@ purple_conv_chat_cb_get_attribute(Purple
 	return g_hash_table_lookup(cb->attributes, key);
 }
 
+static void
+append_attribute_key(gpointer key, gpointer value, gpointer user_data)
+{
+	GList **list = user_data;
+	*list = g_list_prepend(*list, key);
+}
+
 GList *
 purple_conv_chat_cb_get_attribute_keys(PurpleConvChatBuddy *cb)
 {
+	GList *keys = NULL;
+	
 	g_return_val_if_fail(cb != NULL, NULL);
 	
-	return g_hash_table_get_keys(cb->attributes);
+	g_hash_table_foreach(cb->attributes, (GHFunc)append_attribute_key, &keys);
+	
+	return keys;
 }
 
 void


More information about the Commits mailing list