diff options
author | Thomas Haller <thaller@redhat.com> | 2017-11-21 12:42:12 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-11-21 13:48:49 +0100 |
commit | 6b319cd0722085ef686b65b24b2c8de72c0fa25b (patch) | |
tree | be2572f61c94092cc4353d9d460e3bd34773b231 | |
parent | d5b3c6ee53cfa965ee0c219331aab9348bf80107 (diff) | |
download | NetworkManager-6b319cd0722085ef686b65b24b2c8de72c0fa25b.tar.gz |
ifcfg-rh: avoid duplicate lookup of bond-option in write_bond_setting()
Now that nm_setting_bond_get_option() has a stable order
(alphabetically), we no longer need to sort it.
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index 9292640960..c277cb2ad5 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -1311,21 +1311,14 @@ write_bond_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, num_opts = nm_setting_bond_get_num_options (s_bond); if (num_opts) { nm_auto_free_gstring GString *str = NULL; - gs_free const char **options = NULL; - const char *value; + const char *name, *value; str = g_string_sized_new (64); - options = g_new (const char *, num_opts); - for (i = 0; i < num_opts; i++) - nm_setting_bond_get_option (s_bond, i, &options[i], &value); - g_qsort_with_data (options, num_opts, sizeof (const char *), - nm_strcmp_p_with_data, NULL); - for (i = 0; i < num_opts; i++) { if (str->len) g_string_append_c (str, ' '); - value = nm_setting_bond_get_option_by_name (s_bond, options[i]); - g_string_append_printf (str, "%s=%s", options[i], value); + nm_setting_bond_get_option (s_bond, i, &name, &value); + g_string_append_printf (str, "%s=%s", name, value); } svSetValueStr (ifcfg, "BONDING_OPTS", str->str); |