mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 04:18:07 +02:00
ifcfg-rh: refactor parsing bond options
Don't use g_strsplit_set() if all we want to do is split the string at the first '='.
This commit is contained in:
parent
7887909564
commit
afc258519d
1 changed files with 18 additions and 18 deletions
|
|
@ -4802,16 +4802,16 @@ make_bond_setting (shvarFile *ifcfg,
|
||||||
|
|
||||||
items = nm_utils_strsplit_set (v, " ");
|
items = nm_utils_strsplit_set (v, " ");
|
||||||
for (iter = items; iter && *iter; iter++) {
|
for (iter = items; iter && *iter; iter++) {
|
||||||
gs_strfreev char **keys = NULL;
|
gs_free char *key = NULL;
|
||||||
const char *key, *val;
|
const char *val;
|
||||||
|
|
||||||
keys = g_strsplit_set (*iter, "=", 2);
|
val = strchr (*iter, '=');
|
||||||
if (keys && *keys) {
|
if (!val)
|
||||||
key = *keys;
|
continue;
|
||||||
val = *(keys + 1);
|
key = g_strndup (*iter, val - *iter);
|
||||||
if (val && key[0] && val[0])
|
val++;
|
||||||
handle_bond_option (s_bond, key, val);
|
if (key[0] && val[0])
|
||||||
}
|
handle_bond_option (s_bond, key, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5082,16 +5082,16 @@ handle_bridging_opts (NMSetting *setting,
|
||||||
|
|
||||||
items = nm_utils_strsplit_set (value, " ");
|
items = nm_utils_strsplit_set (value, " ");
|
||||||
for (iter = items; iter && *iter; iter++) {
|
for (iter = items; iter && *iter; iter++) {
|
||||||
gs_strfreev char **keys = NULL;
|
gs_free char *key = NULL;
|
||||||
const char *key, *val;
|
const char *val;
|
||||||
|
|
||||||
keys = g_strsplit_set (*iter, "=", 2);
|
val = strchr (*iter, '=');
|
||||||
if (keys && *keys) {
|
if (!val)
|
||||||
key = *keys;
|
continue;
|
||||||
val = *(keys + 1);
|
key = g_strndup (*iter, val - *iter);
|
||||||
if (val && key[0] && val[0])
|
val++;
|
||||||
func (setting, stp, key, val, opt_type);
|
if (key[0] && val[0])
|
||||||
}
|
func (setting, stp, key, val, opt_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue