diff options
| author | Michael Biebl <biebl@debian.org> | 2022-08-12 19:21:11 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2022-08-12 19:21:11 +0200 |
| commit | 6accbd3ec0e42d8633bbde4d47ed7bfe854e7e0b (patch) | |
| tree | a77a0617213a5183a4de43824e3fbae9779e9b8e /src/libnm-glib-aux/nm-shared-utils.h | |
| parent | f7c750061dab327e638c0129cfafd5b2215b3a2e (diff) | |
New upstream version 1.38.4 upstream/1.38.4
Diffstat (limited to 'src/libnm-glib-aux/nm-shared-utils.h')
| -rw-r--r-- | src/libnm-glib-aux/nm-shared-utils.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/libnm-glib-aux/nm-shared-utils.h b/src/libnm-glib-aux/nm-shared-utils.h index 52cf1d4c..0589eeac 100644 --- a/src/libnm-glib-aux/nm-shared-utils.h +++ b/src/libnm-glib-aux/nm-shared-utils.h @@ -623,6 +623,16 @@ nm_utils_is_separator(const char c) /*****************************************************************************/ +static inline GBytes * +nm_g_bytes_ref(GBytes *b) +{ + if (b) + g_bytes_ref(b); + return b; +} + +/*****************************************************************************/ + GBytes *nm_g_bytes_get_empty(void); GBytes *nm_g_bytes_new_from_str(const char *str); @@ -2311,6 +2321,25 @@ nm_g_hash_table_contains(GHashTable *hash, gconstpointer key) return hash ? g_hash_table_contains(hash, key) : FALSE; } +#define nm_g_hash_table_contains_any(hash, ...) \ + ({ \ + GHashTable *const _hash = (hash); \ + gconstpointer const _keys[] = {__VA_ARGS__}; \ + int _i_key; \ + gboolean _contains = FALSE; \ + \ + if (_hash) { \ + for (_i_key = 0; _i_key < (int) G_N_ELEMENTS(_keys); _i_key++) { \ + if (g_hash_table_contains(_hash, _keys[_i_key])) { \ + _contains = TRUE; \ + break; \ + } \ + } \ + } \ + \ + _contains; \ + }) + static inline gboolean nm_g_hash_table_remove(GHashTable *hash, gconstpointer key) { |