/soc/2013/ankitkv/gobjectification: 06ea98f6632b: Used purple_g_...
Ankit Vani
a at nevitus.org
Wed Jul 17 12:17:44 EDT 2013
Changeset: 06ea98f6632b4b4d093ac33b8c25e26d8539f529
Author: Ankit Vani <a at nevitus.org>
Date: 2013-07-17 21:47 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/06ea98f6632b
Description:
Used purple_g_value_new() and purple_g_value_free() for values in PurpleBListNode settings
diffstat:
libpurple/blistnodes.c | 20 ++++----------------
1 files changed, 4 insertions(+), 16 deletions(-)
diffs (58 lines):
diff --git a/libpurple/blistnodes.c b/libpurple/blistnodes.c
--- a/libpurple/blistnodes.c
+++ b/libpurple/blistnodes.c
@@ -208,8 +208,7 @@ purple_blist_node_set_bool(PurpleBListNo
g_return_if_fail(priv->settings != NULL);
g_return_if_fail(key != NULL);
- value = g_new0(GValue, 1);
- g_value_init(value, G_TYPE_BOOLEAN);
+ value = purple_g_value_new(G_TYPE_BOOLEAN);
g_value_set_boolean(value, data);
g_hash_table_replace(priv->settings, g_strdup(key), value);
@@ -250,8 +249,7 @@ purple_blist_node_set_int(PurpleBListNod
g_return_if_fail(priv->settings != NULL);
g_return_if_fail(key != NULL);
- value = g_new0(GValue, 1);
- g_value_init(value, G_TYPE_INT);
+ value = purple_g_value_new(G_TYPE_INT);
g_value_set_int(value, data);
g_hash_table_replace(priv->settings, g_strdup(key), value);
@@ -292,8 +290,7 @@ purple_blist_node_set_string(PurpleBList
g_return_if_fail(priv->settings != NULL);
g_return_if_fail(key != NULL);
- value = g_new0(GValue, 1);
- g_value_init(value, G_TYPE_STRING);
+ value = purple_g_value_new(G_TYPE_STRING);
g_value_set_string(value, data);
g_hash_table_replace(priv->settings, g_strdup(key), value);
@@ -335,15 +332,6 @@ purple_blist_node_get_extended_menu(Purp
return menu;
}
-static void
-purple_blist_node_setting_free(gpointer data)
-{
- GValue *value = (GValue *)data;
-
- g_value_unset(value);
- g_free(value);
-}
-
/**************************************************************************
* GObject code for PurpleBListNode
**************************************************************************/
@@ -392,7 +380,7 @@ purple_blist_node_init(GTypeInstance *in
PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(instance);
priv->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
- (GDestroyNotify)purple_blist_node_setting_free);
+ (GDestroyNotify)purple_g_value_free);
}
/* GObject finalize function */
More information about the Commits
mailing list