/soc/2013/ankitkv/gobjectification: 442af3e72671: Added purple_g...

Ankit Vani a at nevitus.org
Wed Jul 17 12:17:44 EDT 2013


Changeset: 442af3e72671902c5e657ce156400c5338cb0695
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-17 21:45 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/442af3e72671

Description:

Added purple_g_value_new() and purple_g_value_free() to util

diffstat:

 libpurple/util.c |  22 ++++++++++++++++++++++
 libpurple/util.h |  16 ++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)

diffs (58 lines):

diff --git a/libpurple/util.c b/libpurple/util.c
--- a/libpurple/util.c
+++ b/libpurple/util.c
@@ -4747,6 +4747,28 @@ purple_uuid_random(void)
 			(tmp >> 16) & 0xFFFF, g_random_int());
 }
 
+GValue *
+purple_g_value_new(GType type)
+{
+	GValue *ret;
+
+	g_return_val_if_fail(type != G_TYPE_NONE, NULL);
+
+	ret = g_new0(GValue, 1);
+	g_value_init(ret, type);
+
+	return 0;
+}
+
+void
+purple_g_value_free(GValue *value)
+{
+	g_return_if_fail(value != NULL);
+
+	g_value_unset(value);
+	g_free(value);
+}
+
 gchar *purple_http_digest_calculate_session_key(
 		const gchar *algorithm,
 		const gchar *username,
diff --git a/libpurple/util.h b/libpurple/util.h
--- a/libpurple/util.h
+++ b/libpurple/util.h
@@ -1432,6 +1432,22 @@ const gchar *purple_get_host_name(void);
 gchar *purple_uuid_random(void);
 
 /**
+ * Creates a new GValue of the specified type.
+ *
+ * @param type  The type of data to be held by the GValue
+ *
+ * @return  The created GValue
+ */
+GValue *purple_g_value_new(GType type);
+
+/**
+ * Frees a GValue.
+ *
+ * @param value  The GValue to free.
+ */
+void purple_g_value_free(GValue *value);
+
+/**
  * Calculates a session key for HTTP Digest authentation
  *
  * See RFC 2617 for more information.



More information about the Commits mailing list