mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 07:00:13 +01:00
wwan: minor cleanup for owns_port() to return early
I find
for (i = 0; i < n_ports && !owns; i++)
owns = ...
hard to read.
If the condition is satisfied, we can just return the result right
away.
This commit is contained in:
parent
4a10feec16
commit
87f3c50f48
1 changed files with 5 additions and 4 deletions
|
|
@ -213,12 +213,13 @@ owns_port (NMModem *_self, const char *iface)
|
|||
NMModemBroadband *self = NM_MODEM_BROADBAND (_self);
|
||||
const MMModemPortInfo *ports = NULL;
|
||||
guint n_ports = 0, i;
|
||||
gboolean owns = FALSE;
|
||||
|
||||
mm_modem_peek_ports (self->_priv.modem_iface, &ports, &n_ports);
|
||||
for (i = 0; i < n_ports && !owns; i++)
|
||||
owns = (g_strcmp0 (iface, ports[i].name) == 0);
|
||||
return owns;
|
||||
for (i = 0; i < n_ports; i++) {
|
||||
if (nm_streq0 (iface, ports[i].name))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue