From 2a6e7e917f9a567b7561dcfc9ff6de535861966f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 7 Jan 2019 14:29:15 +0100 Subject: [PATCH] shared: add nm_g_variant_ref() and nm_g_variant_unref() helpers Akin to nm_g_object_ref() and nm_g_object_unref(). --- shared/nm-utils/nm-macros-internal.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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. */