mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 02:10:09 +01:00
ethtool: use NM_MORE_ASSERT_ONCE() in _ASSERT_data() to assert immutable data only once
_ASSERT_data() checks static, immutable data. Even with more asserts enabled, there is no need to do that every time. Use NM_MORE_ASSERT_ONCE(). Note that NM_MORE_ASSERT_ONCE() will return constant FALSE, when build without a sufficiently high assertion level. That means, the compiler will just optimize the rest away.
This commit is contained in:
parent
c6e51f61dd
commit
2027ff50af
1 changed files with 3 additions and 2 deletions
|
|
@ -135,9 +135,11 @@ static const guint8 _by_name[_NM_ETHTOOL_ID_NUM] = {
|
|||
static void
|
||||
_ASSERT_data (void)
|
||||
{
|
||||
#if NM_MORE_ASSERTS > 10
|
||||
int i;
|
||||
|
||||
if (!NM_MORE_ASSERT_ONCE (10))
|
||||
return;
|
||||
|
||||
G_STATIC_ASSERT_EXPR (_NM_ETHTOOL_ID_FIRST == 0);
|
||||
G_STATIC_ASSERT_EXPR (_NM_ETHTOOL_ID_LAST == _NM_ETHTOOL_ID_NUM - 1);
|
||||
G_STATIC_ASSERT_EXPR (_NM_ETHTOOL_ID_NUM > 0);
|
||||
|
|
@ -173,7 +175,6 @@ _ASSERT_data (void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue