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:
@@ -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
|
||||
|
Reference in New Issue
Block a user