summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-07-14 20:29:43 +0200
committerThomas Haller <thaller@redhat.com>2022-07-20 10:21:44 +0200
commit22f6ac039d8b4c6c63cd1e8e92ae289c7b75b755 (patch)
treea59ebd1dac84ea35eef944d0239660975d0b14bc
parentc4992c75f7baad55d179592896700d9fd03a48a8 (diff)
downloadNetworkManager-22f6ac039d8b4c6c63cd1e8e92ae289c7b75b755.tar.gz
glib-aux: use max_align_t in NM_HASH_COMBINE_VALS() macro
The _nm_alignas() exists to choose a suitable alignment. Since it's on the stack, it has (almost) no overhead to just use the maximum alignment. That's why gint64 was chosen before. But that isn't the largest alignment. We rely on C11 already, and we also always include <stddef.h>. So use max_align_t instead.
-rw-r--r--src/libnm-glib-aux/nm-hash-utils.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libnm-glib-aux/nm-hash-utils.h b/src/libnm-glib-aux/nm-hash-utils.h
index b7ee4dd17a..e6c7e74adc 100644
--- a/src/libnm-glib-aux/nm-hash-utils.h
+++ b/src/libnm-glib-aux/nm-hash-utils.h
@@ -140,7 +140,7 @@ nm_hash_update_bool(NMHashState *state, bool val)
#define NM_HASH_COMBINE_VALS(var, ...) \
const struct _nm_packed { \
NM_VA_ARGS_FOREACH(, , , _NM_HASH_COMBINE_VALS_TYPE_OP, __VA_ARGS__) \
- } var _nm_alignas(guint64) = { \
+ } var _nm_alignas(max_align_t) = { \
NM_VA_ARGS_FOREACH(, , , _NM_HASH_COMBINE_VALS_INIT_OP, __VA_ARGS__)}
/* nm_hash_update_vals() is faster then nm_hash_update_val() as it combines multiple