gobjectification: babab09c: Add helpers to create, duplicate and fre...
resiak at pidgin.im
resiak at pidgin.im
Wed Jul 9 06:06:00 EDT 2008
-----------------------------------------------------------------
Revision: babab09c6944f786ca4078ef09aaf82bea3aa701
Ancestor: 2bec3817a50dbbc82554c24a7180068faaf9ebf4
Author: resiak at pidgin.im
Date: 2008-07-04T21:37:27
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/babab09c6944f786ca4078ef09aaf82bea3aa701
Modified files:
libpurple/dbus-analyze-functions.py libpurple/util.c
libpurple/util.h
ChangeLog:
Add helpers to create, duplicate and free slice-allocated GValues.
-------------- next part --------------
============================================================
--- libpurple/dbus-analyze-functions.py f473f0ec62d97388d93f580e535de7202ddee09f
+++ libpurple/dbus-analyze-functions.py c3fe2b742d4fa6961173c420815d936ad3315082
@@ -35,6 +35,9 @@ excluded = [\
# as pointer to a struct, instead of a pointer to an enum. This
# causes a compilation error. Someone should fix this script.
"purple_log_read",
+
+ # This is excluded because it'd be a ridiculous function to export.
+ "purple_g_value_slice_free",
]
# This is a list of functions that return a GList* or GSList * whose elements
============================================================
--- libpurple/util.c 50d9a387a5ccb11d782ba14e7460e7179b1c1f96
+++ libpurple/util.c f7344cb03a813584bd482e84d3142856fb7b6da1
@@ -4885,3 +4885,36 @@ gchar *purple_http_digest_calculate_resp
return g_strdup(hash2);
}
+
+
+/****************************************************************************
+ * Slice-allocated GValue helpers
+ *****************************************************************************/
+
+GValue *
+purple_g_value_slice_new(GType type)
+{
+ GValue *ret = g_slice_new0(GValue);
+
+ g_value_init(ret, type);
+ return ret;
+}
+
+
+void
+purple_g_value_slice_free(GValue *value)
+{
+ g_value_unset(value);
+ g_slice_free(GValue, value);
+}
+
+
+GValue *
+purple_g_value_slice_dup(const GValue *value)
+{
+ GValue *ret = purple_g_value_slice_new(G_VALUE_TYPE (value));
+
+ g_value_copy(value, ret);
+ return ret;
+}
+
============================================================
--- libpurple/util.h 9bcb2ac644f7c95c1bd6341f8910f8772f5d4948
+++ libpurple/util.h 4fe129dc62ad2dd89e915d6e2e02c20f29674117
@@ -1325,6 +1325,35 @@ gchar *purple_http_digest_calculate_resp
const gchar *nonce_count, const gchar *client_nonce,
const gchar *session_key);
+
+/** @name Slice-allocated GValue helpers */
+/** @{ */
+
+/**
+ * @param type The type desired for the new GValue
+ * @return a newly allocated, newly initialized #GValue, to be freed with
+ * purple_g_value_slice_free() or g_slice_free().
+ */
+GValue *purple_g_value_slice_new(GType type);
+
+/**
+ * Unsets and frees a slice-allocated GValue.
+ *
+ * @param value A GValue which was allocated with the g_slice API.
+ */
+void purple_g_value_slice_free(GValue *value);
+
+/**
+ * Makes a copy of a GValue.
+ *
+ * @param value A GValue to be copied
+ * @return a newly allocated copy of @a value, to be freed with
+ * purple_g_value_slice_free() or g_slice_free().
+ */
+GValue *purple_g_value_slice_dup(const GValue *value);
+
+/** @} */
+
#ifdef __cplusplus
}
#endif
More information about the Commits
mailing list