mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 13:00:16 +01:00
core: add macros NM_FLAGS_HAS(), NM_FLAGS_ANY() and NM_FLAGS_ALL()
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
3adeffe1f1
commit
bda076bb3c
1 changed files with 9 additions and 0 deletions
|
|
@ -38,6 +38,15 @@ int nm_spawn_process (const char *args);
|
|||
/* macro to return strlen() of a compile time string. */
|
||||
#define STRLEN(str) ( sizeof ("" str) - 1 )
|
||||
|
||||
/* 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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue