summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-03-29 11:59:03 +0200
committerThomas Haller <thaller@redhat.com>2018-04-13 09:09:46 +0200
commitde5d07392da488113c956fbf1aca94fa280c3302 (patch)
treefc8fb9d5327c33805d07639dcfe65e36213e9a47
parent755c8bb30f55e148e6a999f53019c012736a784b (diff)
libnm: optimize nm_simple_connection_new_clone() to not needlessly set the path
Server never sets the path, so this is entirely unused server-side. Also NMConnection is a glib interface and stores it's private date in the GObject's data. It's less efficient to look it up. Just avoid it.
-rw-r--r--libnm-core/nm-simple-connection.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libnm-core/nm-simple-connection.c b/libnm-core/nm-simple-connection.c
index 11700666f5..f06e1aed4b 100644
--- a/libnm-core/nm-simple-connection.c
+++ b/libnm-core/nm-simple-connection.c
@@ -113,11 +113,16 @@ NMConnection *
nm_simple_connection_new_clone (NMConnection *connection)
{
NMConnection *clone;
+ const char *path;
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
clone = nm_simple_connection_new ();
- nm_connection_set_path (clone, nm_connection_get_path (connection));
+
+ path = nm_connection_get_path (connection);
+ if (path)
+ nm_connection_set_path (clone, path);
+
nm_connection_replace_settings_from_connection (clone, connection);
return clone;