summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-05-04 17:14:56 +0200
committerThomas Haller <thaller@redhat.com>2020-05-13 10:28:04 +0200
commitbb19f6e29cfef535665564d5150ed9b4ce025591 (patch)
tree452fb4112a665f5b5a94053c56cc1e97affb4b47
parent0f22f77b1c1f871b0ae85f292e68324413283d06 (diff)
downloadNetworkManager-bb19f6e29cfef535665564d5150ed9b4ce025591.tar.gz
shared: add NM_UTILS_NAMED_VALUE_INIT() macro
-rw-r--r--shared/nm-glib-aux/nm-shared-utils.c3
-rw-r--r--shared/nm-glib-aux/nm-shared-utils.h2
2 files changed, 5 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-shared-utils.c b/shared/nm-glib-aux/nm-shared-utils.c
index 96b09b16d1..39e75a89fe 100644
--- a/shared/nm-glib-aux/nm-shared-utils.c
+++ b/shared/nm-glib-aux/nm-shared-utils.c
@@ -17,6 +17,9 @@
#include "nm-errno.h"
#include "nm-str-buf.h"
+G_STATIC_ASSERT (sizeof (NMUtilsNamedEntry) == sizeof (const char *));
+G_STATIC_ASSERT (G_STRUCT_OFFSET (NMUtilsNamedValue, value_ptr) == sizeof (const char *));
+
/*****************************************************************************/
const void *const _NM_PTRARRAY_EMPTY[1] = { NULL };
diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h
index a2530efafb..cdf6729076 100644
--- a/shared/nm-glib-aux/nm-shared-utils.h
+++ b/shared/nm-glib-aux/nm-shared-utils.h
@@ -1407,6 +1407,8 @@ typedef struct {
};
} NMUtilsNamedValue;
+#define NM_UTILS_NAMED_VALUE_INIT(n, v) { .name = (n), .value_ptr = (v) }
+
NMUtilsNamedValue *nm_utils_named_values_from_str_dict_with_sort (GHashTable *hash,
guint *out_len,
GCompareDataFunc compare_func,