summaryrefslogtreecommitdiff
path: root/clients/cli/settings.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-12-08 10:44:36 +0100
committerThomas Haller <thaller@redhat.com>2017-12-11 15:53:24 +0100
commit7b08331b9d333aaa33e8f025069eb05f80b15ed4 (patch)
tree006e291e068229ffa7d4a91c3aa5d931d59133e2 /clients/cli/settings.c
parent4a38e9338dd1bba68ff267d7716c6e8dd135c3d7 (diff)
downloadNetworkManager-th/cli-strsplit.tar.gz
cli: drop nmc_strsplit_set()th/cli-strsplit
In most cases, it copies the entire strv needlessly. We can do better. Also, the max_tokens argument is handled wrongly (albeit not used anywhere anymore).
Diffstat (limited to 'clients/cli/settings.c')
-rw-r--r--clients/cli/settings.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
index 69275aad48..86035ba4a0 100644
--- a/clients/cli/settings.c
+++ b/clients/cli/settings.c
@@ -313,16 +313,18 @@ _set_fcn_precheck_connection_secondaries (const char *value,
{
const GPtrArray *connections;
NMConnection *con;
+ gs_free const char **strv0 = NULL;
gs_strfreev char **strv = NULL;
char **iter;
- gboolean modified;
+ gboolean modified = FALSE;
- strv = nmc_strsplit_set (value, " \t,", 0);
- if (!strv)
+ strv0 = nm_utils_strsplit_set (value, " \t,");
+ if (!strv0)
return TRUE;
connections = nm_client_get_connections (nm_cli.client);
+ strv = g_strdupv ((char **) strv0);
for (iter = strv; *iter; iter++) {
if (nm_utils_is_uuid (*iter)) {
con = nmc_find_connection (connections, "uuid", *iter, NULL, FALSE);