policy: refactor all_devices_not_active() to any_devices_active()

The double negation is hard to understand.
This commit is contained in:
Thomas Haller 2022-10-26 13:50:41 +02:00
parent 63f4783c59
commit 8e3202e499
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -457,7 +457,7 @@ get_best_active_connection(NMPolicy *self, int addr_family, gboolean fully_activ
}
static gboolean
all_devices_not_active(NMPolicy *self)
any_devices_active(NMPolicy *self)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self);
const CList *tmp_lst;
@ -470,9 +470,9 @@ all_devices_not_active(NMPolicy *self)
if (state <= NM_DEVICE_STATE_DISCONNECTED || state >= NM_DEVICE_STATE_DEACTIVATING) {
continue;
}
return FALSE;
return TRUE;
}
return TRUE;
return FALSE;
}
#define FALLBACK_HOSTNAME4 "localhost.localdomain"
@ -606,7 +606,7 @@ _set_hostname(NMPolicy *self, const char *new_hostname, const char *msg)
priv->updating_dns = TRUE;
nm_dns_manager_set_hostname(priv->dns_manager,
priv->cur_hostname_full,
all_devices_not_active(self));
!any_devices_active(self));
priv->updating_dns = FALSE;
}