summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2013-08-29 15:03:47 -0400
committerColin Walters <walters@verbum.org>2013-08-29 15:03:47 -0400
commit00bd926b02e30484942405379c23e493c048b793 (patch)
treebcd27392d5f8d31108a633dcf092a3ebe205048f
parent033511a303748b2ca7c751f0f132cf9ec778d42e (diff)
downloadlibgsystem-00bd926b02e30484942405379c23e493c048b793.tar.gz
localalloc: Add gs_strfreev
NetworkManager uses strvs quite a lot.
-rw-r--r--gsystem-local-alloc.c6
-rw-r--r--gsystem-local-alloc.h8
2 files changed, 14 insertions, 0 deletions
diff --git a/gsystem-local-alloc.c b/gsystem-local-alloc.c
index 3c3d50a..0d404ff 100644
--- a/gsystem-local-alloc.c
+++ b/gsystem-local-alloc.c
@@ -142,3 +142,9 @@ gs_local_bytes_unref (void *loc)
{
_gs_local_free(GBytes, g_bytes_unref);
}
+
+void
+gs_local_strfreev (void *loc)
+{
+ _gs_local_free(char **, g_strfreev);
+}
diff --git a/gsystem-local-alloc.h b/gsystem-local-alloc.h
index 71ff07d..4c63dcf 100644
--- a/gsystem-local-alloc.h
+++ b/gsystem-local-alloc.h
@@ -40,6 +40,7 @@ void gs_local_ptrarray_unref (void *loc);
void gs_local_hashtable_unref (void *loc);
void gs_local_checksum_free (void *loc);
void gs_local_bytes_unref (void *loc);
+void gs_local_strfreev (void *loc);
/**
* gs_free:
@@ -129,6 +130,13 @@ void gs_local_bytes_unref (void *loc);
*/
#define gs_unref_bytes __attribute__ ((cleanup(gs_local_bytes_unref)))
+/**
+ * gs_strfreev:
+ *
+ * Call g_strfreev() on a variable location when it goes out of scope.
+ */
+#define gs_strfreev __attribute__ ((cleanup(gs_local_strfreev)))
+
G_END_DECLS
#endif