summaryrefslogtreecommitdiff
path: root/gir/glib-2.0.c
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2015-03-02 13:47:46 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2015-03-02 13:47:46 +0100
commit71fe474314ba10c3c7166985e6266ac291e9d546 (patch)
tree07ff086daf70a10f7b331981e5a98d45ba8f777f /gir/glib-2.0.c
parent43917708b8b40e5794f7d78d7b9abb2e1d6664cb (diff)
downloadgobject-introspection-71fe474314ba10c3c7166985e6266ac291e9d546.tar.gz
Update glib annotations from git master
Diffstat (limited to 'gir/glib-2.0.c')
-rw-r--r--gir/glib-2.0.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gir/glib-2.0.c b/gir/glib-2.0.c
index 096432b8..08625f2b 100644
--- a/gir/glib-2.0.c
+++ b/gir/glib-2.0.c
@@ -9907,6 +9907,34 @@
/**
+ * g_autofree:
+ *
+ * Macro to add an attribute to pointer variable to ensure automatic
+ * cleanup using g_free().
+ *
+ * This macro differs from g_autoptr() in that it is an attribute supplied
+ * before the type name, rather than wrapping the type definition. Instead
+ * of using a type-specific lookup, this macro always calls g_free() directly.
+ *
+ * This means it's useful for any type that is returned from
+ * g_malloc().
+ *
+ * Otherwise, this macro has similar constraints as g_autoptr() - only
+ * supported on GCC and clang, the variable must be initialized, etc.
+ *
+ * |[
+ * gboolean
+ * operate_on_malloc_buf (void)
+ * {
+ * g_autofree guint8* membuf = NULL;
+ *
+ * membuf = g_malloc (8192);
+ *
+ * /* Some computation on membuf
+ */
+
+
+/**
* g_autoptr:
* @TypeName: a supported variable type
*