[gnome-builder] util: add helper to steal pointer and clear free func
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] util: add helper to steal pointer and clear free func
- Date: Mon, 9 Apr 2018 21:48:08 +0000 (UTC)
commit 6a7dd13bbfe9a7fd8dc19e3a169e6a183d3fac81
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 9 14:45:24 2018 -0700
util: add helper to steal pointer and clear free func
This allows us to do IDE_PTR_ARRAY_STEAL_FULL(&array) when transfering
ownership as a function parameter.
src/libide/util/ide-glib.h | 3 +++
1 file changed, 3 insertions(+)
---
diff --git a/src/libide/util/ide-glib.h b/src/libide/util/ide-glib.h
index 55b833859..5f0a96a60 100644
--- a/src/libide/util/ide-glib.h
+++ b/src/libide/util/ide-glib.h
@@ -31,6 +31,9 @@ G_BEGIN_DECLS
if ((ar) != NULL) \
g_ptr_array_set_free_func ((ar), (GDestroyNotify)(func)); \
} G_STMT_END
+#define IDE_PTR_ARRAY_STEAL_FULL(arptr) \
+ ({ IDE_PTR_ARRAY_CLEAR_FREE_FUNC (*(arptr)); \
+ g_steal_pointer ((arptr)); })
IDE_AVAILABLE_IN_ALL
const gchar *ide_gettext (const gchar *message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]