Skip to content

Commit

Permalink
[instance] group static variable declaration in Instance together (
Browse files Browse the repository at this point in the history
  • Loading branch information
abtink authored Jan 28, 2025
1 parent c25120e commit 27782ad
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/core/instance/instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,23 @@ class Instance : public otInstance, private NonCopyable
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.
//
Expand All @@ -457,11 +474,8 @@ class Instance : public otInstance, private NonCopyable
#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;

Expand Down Expand Up @@ -720,10 +734,6 @@ class Instance : public otInstance, private NonCopyable
Mac::LinkRaw mLinkRaw;
#endif

#if OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
static LogLevel sLogLevel;
#endif

#if OPENTHREAD_ENABLE_VENDOR_EXTENSION
Extension::ExtensionBase &mExtension;
#endif
Expand All @@ -737,10 +747,6 @@ class Instance : public otInstance, private NonCopyable

bool mIsInitialized;

#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE && (OPENTHREAD_FTD || OPENTHREAD_MTD)
static bool sDnsNameCompressionEnabled;
#endif

uint32_t mId;
};

Expand Down

0 comments on commit 27782ad

Please sign in to comment.