Initialize all member variables in constructors. (#1026)

This commit is contained in:
Jonathan Hui
2016-12-01 08:51:55 -08:00
committed by GitHub
parent 353c3afbdd
commit 9586cfb700
8 changed files with 66 additions and 42 deletions
+2
View File
@@ -133,12 +133,14 @@ const struct Command Interpreter::sCommands[] =
};
Interpreter::Interpreter(otInstance *aInstance):
sServer(NULL),
sLength(8),
sCount(1),
sInterval(1000),
sPingTimer(aInstance->mIp6.mTimerScheduler, &Interpreter::s_HandlePingTimer, this),
mInstance(aInstance)
{
memset(mSlaacAddresses, 0, sizeof(mSlaacAddresses));
mInstance->mIp6.mIcmp.SetEchoReplyHandler(&s_HandleEchoResponse, this);
otSetStateChangedCallback(mInstance, &Interpreter::s_HandleNetifStateChanged, this);
}
+4 -3
View File
@@ -59,9 +59,10 @@ extern "C" void otCliConsoleInputLine(char *aBuf, uint16_t aBufLength)
sServer->ReceiveTask(aBuf, aBufLength);
}
Console::Console(otInstance *aInstance)
: mCallback(NULL),
mInterpreter(aInstance)
Console::Console(otInstance *aInstance):
mCallback(NULL),
mContext(NULL),
mInterpreter(aInstance)
{
}
+2
View File
@@ -46,6 +46,8 @@ Udp::Udp(otInstance *aInstance, Interpreter *aInterpreter):
mInstance(aInstance),
mInterpreter(aInterpreter)
{
memset(&mSocket, 0, sizeof(mSocket));
memset(&mPeer, 0, sizeof(mPeer));
}
ThreadError Udp::Start(void)