mirror of
https://github.com/espressif/openthread.git
synced 2026-07-28 22:57:47 +00:00
[cli] style fixes & remove core defined error constants (#9868)
This commit contains small changes in the CLI modules: - Replace use of core-internal `kError` with `OT_ERROR` constants. - Remove `#endif` comments when the corresponding `#if` is less than 20 lines away adhering to OT style guide. - Adhere to single `return` policy (use `ExitNow()`). - Avoid calling `static` method `ParseToIp6Address()` with an object. - Smaller style fixes: New lines after variable declaration, use shorter local variable names, etc.
This commit is contained in:
+9
-8
@@ -132,11 +132,11 @@ template <> otError UdpExample::Process<Cmd("connect")>(Arg aArgs[])
|
||||
{
|
||||
otError error;
|
||||
otSockAddr sockaddr;
|
||||
bool nat64SynthesizedAddress;
|
||||
bool nat64Synth;
|
||||
|
||||
SuccessOrExit(
|
||||
error = Interpreter::ParseToIp6Address(GetInstancePtr(), aArgs[0], sockaddr.mAddress, nat64SynthesizedAddress));
|
||||
if (nat64SynthesizedAddress)
|
||||
SuccessOrExit(error = Interpreter::ParseToIp6Address(GetInstancePtr(), aArgs[0], sockaddr.mAddress, nat64Synth));
|
||||
|
||||
if (nat64Synth)
|
||||
{
|
||||
OutputFormat("Connecting to synthesized IPv6 address: ");
|
||||
OutputIp6AddressLine(sockaddr.mAddress);
|
||||
@@ -267,11 +267,12 @@ template <> otError UdpExample::Process<Cmd("send")>(Arg aArgs[])
|
||||
|
||||
if (!aArgs[2].IsEmpty())
|
||||
{
|
||||
bool nat64SynthesizedAddress;
|
||||
bool nat64Synth;
|
||||
|
||||
SuccessOrExit(error = Interpreter::ParseToIp6Address(GetInstancePtr(), aArgs[0], messageInfo.mPeerAddr,
|
||||
nat64SynthesizedAddress));
|
||||
if (nat64SynthesizedAddress)
|
||||
SuccessOrExit(
|
||||
error = Interpreter::ParseToIp6Address(GetInstancePtr(), aArgs[0], messageInfo.mPeerAddr, nat64Synth));
|
||||
|
||||
if (nat64Synth)
|
||||
{
|
||||
OutputFormat("Sending to synthesized IPv6 address: ");
|
||||
OutputIp6AddressLine(messageInfo.mPeerAddr);
|
||||
|
||||
Reference in New Issue
Block a user