[libgsystem] localalloc: Add gs_free_error
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgsystem] localalloc: Add gs_free_error
- Date: Mon, 21 Oct 2013 14:48:25 +0000 (UTC)
commit 8ba987599ba6045dfe422e527d51aa3e090cd812
Author: Christian Persch <chpe gnome org>
Date: Mon Oct 21 14:44:49 2013 +0200
localalloc: Add gs_free_error
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 fa4971d..3879b00 100644
--- a/gsystem-local-alloc.c
+++ b/gsystem-local-alloc.c
@@ -148,3 +148,9 @@ gs_local_strfreev (void *loc)
{
_gs_local_free(char **, g_strfreev);
}
+
+void
+gs_local_free_error (void *loc)
+{
+ _gs_local_free(GError*, g_error_free);
+}
diff --git a/gsystem-local-alloc.h b/gsystem-local-alloc.h
index 4c63dcf..150748c 100644
--- a/gsystem-local-alloc.h
+++ b/gsystem-local-alloc.h
@@ -41,6 +41,7 @@ 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);
+void gs_local_free_error (void *loc);
/**
* gs_free:
@@ -137,6 +138,13 @@ void gs_local_strfreev (void *loc);
*/
#define gs_strfreev __attribute__ ((cleanup(gs_local_strfreev)))
+/**
+ * gs_free_error:
+ *
+ * Call g_error_free() on a variable location when it goes out of scope.
+ */
+#define gs_free_error __attribute__ ((cleanup(gs_local_free_error)))
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]