mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 02:57:58 +02:00
libnm,core: use NM_FLAGS_ANY() for MODEM_CAPS_3GPP()/MODEM_CAPS_3GPP2()
Macros should (where possible and sensible) behave function-like. That means for example, that they evaluate arguments only once, and use parentheses around code that expands, so that unexpected uses work correctly. The parentheses was missing. Instead, just use the NM_FLAGS_ANY() macro which gets this right.
This commit is contained in:
parent
e9de583bb9
commit
8f6423ac06
2 changed files with 6 additions and 6 deletions
|
|
@ -37,7 +37,7 @@ MODEM_CAPS_3GPP(MMModemCapability caps)
|
|||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
#define MODEM_CAPS_3GPP2(caps) (caps & (MM_MODEM_CAPABILITY_CDMA_EVDO))
|
||||
#define MODEM_CAPS_3GPP2(caps) NM_FLAGS_ANY((caps), MM_MODEM_CAPABILITY_CDMA_EVDO)
|
||||
|
||||
/* Maximum time to keep the DBus call waiting for a connection result.
|
||||
* This value is greater than the default timeout in ModemManager (180s since
|
||||
|
|
|
|||
|
|
@ -153,12 +153,12 @@ get_type_description(NMDevice *device)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#define MODEM_CAPS_3GPP(caps) \
|
||||
(caps \
|
||||
& (NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS | NM_DEVICE_MODEM_CAPABILITY_LTE \
|
||||
| NM_DEVICE_MODEM_CAPABILITY_5GNR))
|
||||
#define MODEM_CAPS_3GPP(caps) \
|
||||
NM_FLAGS_ANY((caps), \
|
||||
(NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS | NM_DEVICE_MODEM_CAPABILITY_LTE \
|
||||
| NM_DEVICE_MODEM_CAPABILITY_5GNR))
|
||||
|
||||
#define MODEM_CAPS_3GPP2(caps) (caps & (NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO))
|
||||
#define MODEM_CAPS_3GPP2(caps) NM_FLAGS_ANY((caps), NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)
|
||||
|
||||
static gboolean
|
||||
connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue