diff options
| author | Michael Biebl <biebl@debian.org> | 2022-08-13 16:40:06 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2022-08-13 16:40:06 +0200 |
| commit | 38ca7ae9c3556e9a5b50ee15015ea194e6ca8da1 (patch) | |
| tree | 99f19f118f550362c3288e7b82a7aab3a75c8d64 /src/libnm-glib-aux/nm-shared-utils.h | |
| parent | c2473cb3f165975f2899ccef11f036c9762a8aa3 (diff) | |
| parent | 49ac65f875a36d7ebcbc8270cf0fc60acbb2e052 (diff) | |
Merge tag 'debian/1.38.4-1' into debian/bullseye-backports
network-manager Debian release 1.38.4-1
Diffstat (limited to 'src/libnm-glib-aux/nm-shared-utils.h')
| -rw-r--r-- | src/libnm-glib-aux/nm-shared-utils.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/libnm-glib-aux/nm-shared-utils.h b/src/libnm-glib-aux/nm-shared-utils.h index daefa068..0589eeac 100644 --- a/src/libnm-glib-aux/nm-shared-utils.h +++ b/src/libnm-glib-aux/nm-shared-utils.h @@ -216,7 +216,7 @@ nm_ether_addr_equal(const NMEtherAddr *a, const NMEtherAddr *b) typedef struct { union { - guint8 addr_ptr[1]; + guint8 addr_ptr[sizeof(struct in6_addr)]; in_addr_t addr4; struct in_addr addr4_struct; struct in6_addr addr6; @@ -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) { |