[libgsystem] localalloc: Add gs_unref_array()
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgsystem] localalloc: Add gs_unref_array()
- Date: Fri, 2 Aug 2013 22:34:23 +0000 (UTC)
commit a53219add5cbf9a9026422ea72b2e37dc3febe52
Author: Colin Walters <walters verbum org>
Date: Fri Aug 2 18:33:15 2013 -0400
localalloc: Add gs_unref_array()
Requested by NetworkManager team.
gsystem-local-alloc.c | 6 ++++++
gsystem-local-alloc.h | 11 +++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gsystem-local-alloc.c b/gsystem-local-alloc.c
index 243f7ac..fbf1997 100644
--- a/gsystem-local-alloc.c
+++ b/gsystem-local-alloc.c
@@ -114,6 +114,12 @@ gs_local_ptrarray_unref (void *loc)
}
void
+gs_local_array_unref (void *loc)
+{
+ _gs_local_free(GArray, g_array_unref);
+}
+
+void
gs_local_hashtable_unref (void *loc)
{
_gs_local_free(GHashTable, g_hash_table_unref);
diff --git a/gsystem-local-alloc.h b/gsystem-local-alloc.h
index a44c4d4..8797cac 100644
--- a/gsystem-local-alloc.h
+++ b/gsystem-local-alloc.h
@@ -34,6 +34,7 @@ void gs_local_free (void *loc);
void gs_local_obj_unref (void *loc);
void gs_local_variant_unref (void *loc);
void gs_local_variant_iter_free (void *loc);
+void gs_local_array_unref (void *loc);
void gs_local_ptrarray_unref (void *loc);
void gs_local_hashtable_unref (void *loc);
@@ -71,6 +72,16 @@ void gs_local_hashtable_unref (void *loc);
#define gs_free_variant_iter __attribute__ ((cleanup(gs_local_variant_iter_free)))
/**
+ * gs_unref_array:
+ *
+ * Call g_array_unref() on a variable location when it goes out of
+ * scope. Note that unlike g_array_unref(), the variable may be
+ * %NULL.
+
+ */
+#define gs_unref_array __attribute__ ((cleanup(gs_local_array_unref)))
+
+/**
* gs_unref_ptrarray:
*
* Call g_ptr_array_unref() on a variable location when it goes out of
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]