diff options
author | Thomas Haller <thaller@redhat.com> | 2019-04-18 08:16:27 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-04-18 09:52:26 +0200 |
commit | 8339657d4b6efa16570276d9b772c9ade2b63703 (patch) | |
tree | b19c2aaf6e6c78d6146b94b3a29e0233bba9c28f | |
parent | f06589bcbba8e321348755ec1f37ac6df0fb7858 (diff) | |
download | NetworkManager-th/strsplit-pt4.tar.gz |
cli: use "escaped-tokens" style for splitting "vlan.xgress-priority-map" listth/strsplit-pt4
There should be little difference here, because the priority list is
(and was) never serialized with special characters like backslashes or
delimiters that require escaping.
Likewise, no working code actually tried to set such characters.
Still, drop the plain VALUE_STRSPLIT_MODE_STRIPPED and use
VALUE_STRSPLIT_MODE_ESCAPED_TOKENS_WITH_SPACES instead. We should have
a small set of modes that we use for splitting strings.
-rw-r--r-- | clients/common/nm-meta-setting-desc.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 53a945c827..ffaf60714c 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -172,7 +172,6 @@ _value_str_as_index_list (const char *value, gsize *out_len) #define ESCAPED_TOKENS_DELIMITERS "," typedef enum { - VALUE_STRSPLIT_MODE_STRIPPED, VALUE_STRSPLIT_MODE_OBJLIST, VALUE_STRSPLIT_MODE_MULTILIST, VALUE_STRSPLIT_MODE_ESCAPED_TOKENS, @@ -194,10 +193,6 @@ _value_strsplit (const char *value, /* note that all modes remove empty tokens (",", "a,,b", ",,"). */ switch (split_mode) { - case VALUE_STRSPLIT_MODE_STRIPPED: - strv = nm_utils_strsplit_set (value, ESCAPED_TOKENS_WITH_SPACES_DELIMTERS); - NM_SET_OUT (out_len, NM_PTRARRAY_LEN (strv)); - return g_steal_pointer (&strv); case VALUE_STRSPLIT_MODE_OBJLIST: strv = nm_utils_strsplit_set (value, ESCAPED_TOKENS_DELIMITERS); break; @@ -3860,7 +3855,7 @@ _get_fcn_vlan_xgress_priority_map (ARGS_GET_FCN) if (!str) str = g_string_new (NULL); else - g_string_append_c (str, ','); + g_string_append_c (str, ESCAPED_TOKENS_WITH_SPACES_DELIMTER); g_string_append_printf (str, "%d:%d", from, to); } @@ -3882,7 +3877,7 @@ _set_fcn_vlan_xgress_priority_map (ARGS_SET_FCN) return TRUE; } - prio_map = _value_strsplit (value, VALUE_STRSPLIT_MODE_STRIPPED, &len); + prio_map = _value_strsplit (value, VALUE_STRSPLIT_MODE_ESCAPED_TOKENS_WITH_SPACES, &len); for (i = 0; i < len; i++) { if (!nm_utils_vlan_priority_map_parse_str (map_type, |