summaryrefslogtreecommitdiff
path: root/src/devices/wwan
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-03-14 08:57:42 +0100
committerThomas Haller <thaller@redhat.com>2018-03-20 15:08:18 +0100
commite17cd1d742c47122b159040ce23fbf684b21c486 (patch)
tree5d3cee96a3068eb39539a61c52e5b989c2010969 /src/devices/wwan
parentf063ab41e96b1b62719837a51f71ac1d44c44b10 (diff)
downloadNetworkManager-e17cd1d742c47122b159040ce23fbf684b21c486.tar.gz
core: avoid clone of all-connections list for nm_utils_complete_generic()
NMSettings exposes a cached list of all connection. We don't need to clone it. Note that this is not save against concurrent modification, meaning, add/remove of connections in NMSettings will invalidate the list. However, it wasn't save against that previously either, because altough we cloned the container (GSList), we didn't take an additional reference to the elements. This is purely a performance optimization, we don't need to clone the list. Also, since the original list is of type "NMConnection *const*", use that type insistently, instead of dependent API requiring GSList. IMO, GSList is anyway not a very nice API for many use cases because it requires an additional slice allocation for each element. It's slower, and often less convenient to use.
Diffstat (limited to 'src/devices/wwan')
-rw-r--r--src/devices/wwan/nm-device-modem.c2
-rw-r--r--src/devices/wwan/nm-modem-broadband.c2
-rw-r--r--src/devices/wwan/nm-modem.c2
-rw-r--r--src/devices/wwan/nm-modem.h4
4 files changed, 5 insertions, 5 deletions
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index 0820b82db0..2a3e9ebeb7 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -434,7 +434,7 @@ static gboolean
complete_connection (NMDevice *device,
NMConnection *connection,
const char *specific_object,
- const GSList *existing_connections,
+ NMConnection *const*existing_connections,
GError **error)
{
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE ((NMDeviceModem *) device);
diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
index be0c236201..9a3744db3c 100644
--- a/src/devices/wwan/nm-modem-broadband.c
+++ b/src/devices/wwan/nm-modem-broadband.c
@@ -663,7 +663,7 @@ check_connection_compatible (NMModem *_self, NMConnection *connection)
static gboolean
complete_connection (NMModem *_self,
NMConnection *connection,
- const GSList *existing_connections,
+ NMConnection *const*existing_connections,
GError **error)
{
NMModemBroadband *self = NM_MODEM_BROADBAND (_self);
diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c
index 7dcbec1b41..61b7247ec8 100644
--- a/src/devices/wwan/nm-modem.c
+++ b/src/devices/wwan/nm-modem.c
@@ -1091,7 +1091,7 @@ nm_modem_check_connection_compatible (NMModem *self, NMConnection *connection)
gboolean
nm_modem_complete_connection (NMModem *self,
NMConnection *connection,
- const GSList *existing_connections,
+ NMConnection *const*existing_connections,
GError **error)
{
NMModemClass *klass;
diff --git a/src/devices/wwan/nm-modem.h b/src/devices/wwan/nm-modem.h
index a95da25534..3e281c0c92 100644
--- a/src/devices/wwan/nm-modem.h
+++ b/src/devices/wwan/nm-modem.h
@@ -126,7 +126,7 @@ typedef struct {
gboolean (*complete_connection) (NMModem *modem,
NMConnection *connection,
- const GSList *existing_connections,
+ NMConnection *const*existing_connections,
GError **error);
NMActStageReturn (*act_stage1_prepare) (NMModem *modem,
@@ -189,7 +189,7 @@ gboolean nm_modem_check_connection_compatible (NMModem *self, NMConnection *conn
gboolean nm_modem_complete_connection (NMModem *self,
NMConnection *connection,
- const GSList *existing_connections,
+ NMConnection *const*existing_connections,
GError **error);
void nm_modem_get_route_parameters (NMModem *self,