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:
@@ -4802,18 +4802,18 @@ 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++;
|
||||||
|
if (key[0] && val[0])
|
||||||
handle_bond_option (s_bond, key, val);
|
handle_bond_option (s_bond, key, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return (NMSetting *) s_bond;
|
return (NMSetting *) s_bond;
|
||||||
}
|
}
|
||||||
@@ -5082,18 +5082,18 @@ 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++;
|
||||||
|
if (key[0] && val[0])
|
||||||
func (setting, stp, key, val, opt_type);
|
func (setting, stp, key, val, opt_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_bridge_vlans (shvarFile *ifcfg,
|
read_bridge_vlans (shvarFile *ifcfg,
|
||||||
|
Reference in New Issue
Block a user