[libgsystem] localalloc: Add gs_strfreev
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgsystem] localalloc: Add gs_strfreev
- Date: Thu, 29 Aug 2013 19:04:18 +0000 (UTC)
commit 00bd926b02e30484942405379c23e493c048b793
Author: Colin Walters <walters verbum org>
Date: Thu Aug 29 15:03:47 2013 -0400
localalloc: Add gs_strfreev
NetworkManager uses strvs quite a lot.
gsystem-local-alloc.c | 6 ++++++
gsystem-local-alloc.h | 8 ++++++++
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]