From 88bdeecf7cbc4d7ce0929a0d31648b7373a0ee6d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 25 May 2015 11:19:28 +0200 Subject: [PATCH] utils: move NM_FLAGS_*() macros to header file "include/nm-utils-internal.h" (cherry picked from commit dce00f0d1087098cd4b2f27bbb9905e1d6c450d9) --- include/nm-utils-internal.h | 10 ++++++++++ src/NetworkManagerUtils.h | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/nm-utils-internal.h b/include/nm-utils-internal.h index 059d2b7d75..2d87c7d6cb 100644 --- a/include/nm-utils-internal.h +++ b/include/nm-utils-internal.h @@ -181,4 +181,14 @@ nm_clear_g_source (guint *id) /*****************************************************************************/ +/* check if @flags has exactly one flag (@check) set. You should call this + * only with @check being a compile time constant and a power of two. */ +#define NM_FLAGS_HAS(flags, check) \ + ( (G_STATIC_ASSERT_EXPR ( ((check) != 0) && ((check) & ((check)-1)) == 0 )), (NM_FLAGS_ANY ((flags), (check))) ) + +#define NM_FLAGS_ANY(flags, check) ( ( ((flags) & (check)) != 0 ) ? TRUE : FALSE ) +#define NM_FLAGS_ALL(flags, check) ( ( ((flags) & (check)) == (check) ) ? TRUE : FALSE ) + +/*****************************************************************************/ + #endif diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h index 03836abd5d..10f1f12f63 100644 --- a/src/NetworkManagerUtils.h +++ b/src/NetworkManagerUtils.h @@ -53,15 +53,6 @@ int nm_spawn_process (const char *args, GError **error); int nm_utils_modprobe (GError **error, const char *arg1, ...) G_GNUC_NULL_TERMINATED; -/* check if @flags has exactly one flag (@check) set. You should call this - * only with @check being a compile time constant and a power of two. */ -#define NM_FLAGS_HAS(flags, check) \ - ( (G_STATIC_ASSERT_EXPR ( ((check) != 0) && ((check) & ((check)-1)) == 0 )), (NM_FLAGS_ANY ((flags), (check))) ) - -#define NM_FLAGS_ANY(flags, check) ( ( ((flags) & (check)) != 0 ) ? TRUE : FALSE ) -#define NM_FLAGS_ALL(flags, check) ( ( ((flags) & (check)) == (check) ) ? TRUE : FALSE ) - - /** * str_if_set: * @str: input string that will be returned if @str is not %NULL