utils: move NM_FLAGS_*() macros to header file "include/nm-utils-internal.h"

This commit is contained in:
Thomas Haller
2015-05-25 11:19:28 +02:00
parent 2297333bb1
commit dce00f0d10
2 changed files with 10 additions and 9 deletions

View File

@@ -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 #endif

View File

@@ -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; 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_if_set:
* @str: input string that will be returned if @str is not %NULL * @str: input string that will be returned if @str is not %NULL