diff options
author | Thomas Haller <thaller@redhat.com> | 2020-06-07 00:04:52 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-06-19 17:07:26 +0200 |
commit | cdb38df7e5c29994472bcca5206de2a773d7fd3a (patch) | |
tree | e4f8717a1a4ae17fffb1372373b68b029a0a5206 | |
parent | 91d6461761b187593483507fb6631b3aa5084289 (diff) | |
download | NetworkManager-cdb38df7e5c29994472bcca5206de2a773d7fd3a.tar.gz |
shared,core: rename and move function to nm_utils_strdict_to_variant_asv()
-rw-r--r-- | shared/nm-glib-aux/nm-shared-utils.c | 27 | ||||
-rw-r--r-- | shared/nm-glib-aux/nm-shared-utils.h | 1 | ||||
-rw-r--r-- | src/nm-core-utils.c | 27 | ||||
-rw-r--r-- | src/nm-core-utils.h | 2 | ||||
-rw-r--r-- | src/nm-dhcp-config.c | 2 |
5 files changed, 29 insertions, 30 deletions
diff --git a/shared/nm-glib-aux/nm-shared-utils.c b/shared/nm-glib-aux/nm-shared-utils.c index baa91646e8..918964e785 100644 --- a/shared/nm-glib-aux/nm-shared-utils.c +++ b/shared/nm-glib-aux/nm-shared-utils.c @@ -527,6 +527,33 @@ out: /*****************************************************************************/ +GVariant * +nm_utils_strdict_to_variant_asv (GHashTable *strdict) +{ + gs_free NMUtilsNamedValue *values_free = NULL; + NMUtilsNamedValue values_prepared[20]; + const NMUtilsNamedValue *values; + GVariantBuilder builder; + guint i; + guint n; + + values = nm_utils_named_values_from_strdict (strdict, + &n, + values_prepared, + &values_free); + + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + for (i = 0; i < n; i++) { + g_variant_builder_add (&builder, + "{sv}", + values[i].name, + g_variant_new_string (values[i].value_str)); + } + return g_variant_builder_end (&builder); +} + +/*****************************************************************************/ + /** * nm_strquote: * @buf: the output buffer of where to write the quoted @str argument. diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h index a74422043a..67997e6b58 100644 --- a/shared/nm-glib-aux/nm-shared-utils.h +++ b/shared/nm-glib-aux/nm-shared-utils.h @@ -422,6 +422,7 @@ gboolean nm_utils_gbytes_equal_mem (GBytes *bytes, GVariant *nm_utils_gbytes_to_variant_ay (GBytes *bytes); GVariant *nm_utils_strdict_to_variant_ass (GHashTable *strdict); +GVariant *nm_utils_strdict_to_variant_asv (GHashTable *strdict); /*****************************************************************************/ diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c index 2492fc10aa..bc80dabf35 100644 --- a/src/nm-core-utils.c +++ b/src/nm-core-utils.c @@ -4108,33 +4108,6 @@ nm_utils_parse_dns_domain (const char *domain, gboolean *is_routing) /*****************************************************************************/ -GVariant * -nm_utils_strdict_to_variant (GHashTable *options) -{ - gs_free NMUtilsNamedValue *values_free = NULL; - NMUtilsNamedValue values_prepared[20]; - const NMUtilsNamedValue *values; - GVariantBuilder builder; - guint i; - guint n; - - values = nm_utils_named_values_from_strdict (options, - &n, - values_prepared, - &values_free); - - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - for (i = 0; i < n; i++) { - g_variant_builder_add (&builder, - "{sv}", - values[i].name, - g_variant_new_string (values[i].value_str)); - } - return g_variant_builder_end (&builder); -} - -/*****************************************************************************/ - static guint32 get_max_rate_ht_20 (int mcs) { diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h index e30d7b3651..b36c9b581f 100644 --- a/src/nm-core-utils.h +++ b/src/nm-core-utils.h @@ -449,8 +449,6 @@ gboolean nm_utils_validate_plugin (const char *path, struct stat *stat, GError * char **nm_utils_read_plugin_paths (const char *dirname, const char *prefix); char *nm_utils_format_con_diff_for_audit (GHashTable *diff); -GVariant *nm_utils_strdict_to_variant (GHashTable *options); - /*****************************************************************************/ /* this enum is compatible with ICMPV6_ROUTER_PREF_* (from <linux/icmpv6.h>, diff --git a/src/nm-dhcp-config.c b/src/nm-dhcp-config.c index 3b9211df99..fd55c3ff43 100644 --- a/src/nm-dhcp-config.c +++ b/src/nm-dhcp-config.c @@ -75,7 +75,7 @@ nm_dhcp_config_set_options (NMDhcpConfig *self, priv = NM_DHCP_CONFIG_GET_PRIVATE (self); nm_g_variant_unref (priv->options); - priv->options = g_variant_ref_sink (nm_utils_strdict_to_variant (options)); + priv->options = g_variant_ref_sink (nm_utils_strdict_to_variant_asv (options)); _notify (self, PROP_OPTIONS); } |