[instance] group static variable declaration in Instance together (#11193)

This commit is contained in:
Abtin Keshavarzian
2025-01-27 21:28:06 -08:00
committed by GitHub
parent c25120edc0
commit 27782ad164
+18 -12
View File
@@ -442,6 +442,23 @@ private:
void AfterInit(void);
#endif
//-----------------------------------------------------------------------------------------------------------------
// `static` variables
#if OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
static LogLevel sLogLevel;
#endif
#if (OPENTHREAD_MTD || OPENTHREAD_FTD) && !OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
static Utils::Heap *sHeap;
#endif
#if (OPENTHREAD_MTD || OPENTHREAD_FTD) && OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
static bool sDnsNameCompressionEnabled;
#endif
//-----------------------------------------------------------------------------------------------------------------
// Order of variables (their initialization in `Instance`)
// is important.
//
@@ -457,11 +474,8 @@ private:
#if OPENTHREAD_MTD || OPENTHREAD_FTD
// Random::Manager is initialized before other objects. Note that it
// requires MbedTls which itself may use Heap.
#if !OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
static Utils::Heap *sHeap;
#endif
Crypto::MbedTls mMbedTls;
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
#endif
Random::Manager mRandomManager;
@@ -720,10 +734,6 @@ private:
Mac::LinkRaw mLinkRaw;
#endif
#if OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
static LogLevel sLogLevel;
#endif
#if OPENTHREAD_ENABLE_VENDOR_EXTENSION
Extension::ExtensionBase &mExtension;
#endif
@@ -737,10 +747,6 @@ private:
bool mIsInitialized;
#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE && (OPENTHREAD_FTD || OPENTHREAD_MTD)
static bool sDnsNameCompressionEnabled;
#endif
uint32_t mId;
};