summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2018-10-17 11:32:35 +0200
committerAleksander Morgado <aleksander@aleksander.es>2018-10-17 11:38:02 +0200
commitce04c635358d9ac1bdbdf3bcbc70e469a9f6317f (patch)
tree397eced50200fe2304fc12c20e5248e89ae5950e
parent0073cbed59a270e1a8f18f591d31cbaf64a995ae (diff)
downloadlibmbim-aleksander/proxy-fixes.tar.gz
libmbim-glib,proxy: compare MbimDevices by pointer not by pathaleksander/proxy-fixes
The MbimDevice objects are stored in the proxy private info, and additional references of the same objects are also referenced in each client info. We can do a much quicker MbimDevice comparison just by comparing pointers directly instead of paths.
-rw-r--r--src/libmbim-glib/mbim-proxy.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libmbim-glib/mbim-proxy.c b/src/libmbim-glib/mbim-proxy.c
index 9489e77..11b0529 100644
--- a/src/libmbim-glib/mbim-proxy.c
+++ b/src/libmbim-glib/mbim-proxy.c
@@ -434,7 +434,7 @@ peek_opening_device_info (MbimProxy *self,
OpeningDevice *info;
info = (OpeningDevice *)(l->data);
- if (g_str_equal (mbim_device_get_path (device), mbim_device_get_path (info->device)))
+ if (device == info->device)
return info;
}
@@ -1285,7 +1285,7 @@ merge_client_service_subscribe_lists (MbimProxy *self,
continue;
/* Add per-client list */
- if (g_str_equal (mbim_device_get_path (((Client *)(l->data))->device), mbim_device_get_path (device)))
+ if (client->device == device)
updated = _mbim_proxy_helper_service_subscribe_list_merge (updated, updated_size,
client->mbim_event_entry_array, client->mbim_event_entry_array_size,
&updated_size);
@@ -1332,7 +1332,7 @@ reset_client_service_subscribe_lists (MbimProxy *self,
if (!client->mbim_event_entry_array)
continue;
- if (g_str_equal (mbim_device_get_path (((Client *)(l->data))->device), mbim_device_get_path (device))) {
+ if (client->device == device) {
g_clear_pointer (&client->mbim_event_entry_array, mbim_event_entry_array_free);
client->mbim_event_entry_array_size = 0;
}
@@ -1400,7 +1400,7 @@ untrack_device (MbimProxy *self,
/* Lookup all clients with this device */
for (l = self->priv->clients; l; l = g_list_next (l)) {
- if (g_str_equal (mbim_device_get_path (((Client *)(l->data))->device), mbim_device_get_path (device)))
+ if (((Client *)(l->data))->device == device)
to_remove = g_list_append (to_remove, l->data);
}