summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-01-07 14:29:15 +0100
committerThomas Haller <thaller@redhat.com>2019-01-14 11:55:17 +0100
commit2a6e7e917f9a567b7561dcfc9ff6de535861966f (patch)
tree09abb88f7db82c3ae1737f1c4f23be26b5faa95d
parent240e2bd9f8b40b4c58538c6979ac4a4194cd3bad (diff)
downloadNetworkManager-2a6e7e917f9a567b7561dcfc9ff6de535861966f.tar.gz
shared: add nm_g_variant_ref() and nm_g_variant_unref() helpers
Akin to nm_g_object_ref() and nm_g_object_unref().
-rw-r--r--shared/nm-utils/nm-macros-internal.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h
index 3578a55291..b993b3840c 100644
--- a/shared/nm-utils/nm-macros-internal.h
+++ b/shared/nm-utils/nm-macros-internal.h
@@ -1129,6 +1129,23 @@ nm_clear_g_cancellable (GCancellable **cancellable)
/*****************************************************************************/
+static inline GVariant *
+nm_g_variant_ref (GVariant *v)
+{
+ if (v)
+ g_variant_ref (v);
+ return v;
+}
+
+static inline void
+nm_g_variant_unref (GVariant *v)
+{
+ if (v)
+ g_variant_unref (v);
+}
+
+/*****************************************************************************/
+
/* Determine whether @x is a power of two (@x being an integer type).
* Basically, this returns TRUE, if @x has exactly one bit set.
* For negative values and zero, this always returns FALSE. */